use ethkeys to parse enr key

This commit is contained in:
Jacek Sieka 2020-05-20 07:35:34 +02:00
parent 383b22795c
commit 418888f1d0
No known key found for this signature in database
GPG Key ID: A1B09461ABB656B8
1 changed files with 4 additions and 3 deletions

View File

@ -317,10 +317,11 @@ proc init*(p: typedesc[PeerInfo],
if trecOpt.isSome(): if trecOpt.isSome():
trec = trecOpt.get() trec = trecOpt.get()
if trec.secp256k1.isSome(): if trec.secp256k1.isSome():
let skpubkey = lsecp.SkPublicKey.init(trec.secp256k1.get()) let skpubkey = ethkeys.PublicKey.fromRaw(trec.secp256k1.get())
if skpubkey.isOk(): if skpubkey.isOk():
let peerid = PeerID.init(PublicKey(scheme: Secp256k1, let peerid = PeerID.init(
skkey: skpubkey.get())) PublicKey(scheme: Secp256k1,
skkey: lsecp.SkPublicKey(skpubkey.get())))
var mas = newSeq[MultiAddress]() var mas = newSeq[MultiAddress]()
if trec.ip.isSome() and trec.tcp.isSome(): if trec.ip.isSome() and trec.tcp.isSome():
let ma = MultiAddress.init(multiCodec("ip4"), trec.ip.get()) & let ma = MultiAddress.init(multiCodec("ip4"), trec.ip.get()) &