From f39a5cf5e4e548eaa869fc90aa3eda1285ee8e53 Mon Sep 17 00:00:00 2001 From: Dmitriy Ryajov Date: Thu, 12 Sep 2019 15:57:36 -0600 Subject: [PATCH] temporary fix, until pub/priv keys are Option[T] --- libp2p/protocols/identify.nim | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) diff --git a/libp2p/protocols/identify.nim b/libp2p/protocols/identify.nim index 92839a7..cae24a7 100644 --- a/libp2p/protocols/identify.nim +++ b/libp2p/protocols/identify.nim @@ -70,6 +70,7 @@ proc decodeMsg*(buf: seq[byte]): IdentifyInfo = var pubKey: PublicKey if pb.getValue(1, pubKey) > 0: result.pubKey = some(pubKey) + debug "PUBKEY", pubKey = pubKey result.addrs = newSeq[MultiAddress]() var address = newSeq[byte]() @@ -123,12 +124,14 @@ proc identify*(p: Identify, result = decodeMsg(message) debug "identify: Identify for remote peer succeded" - if remotePeerInfo.peerId.isSome and - result.pubKey.isSome and - result.pubKey.get() != remotePeerInfo.peerId.get().publicKey: - debug "identify: Peer's remote public key doesn't match" - raise newException(IdentityNoMatchError, - "Peer's remote public key doesn't match") + # TODO: To enable the blow code, the private and public + # keys in PeerID need to be wrapped with Option[T] + # if remotePeerInfo.peerId.isSome and + # result.pubKey.isSome and + # result.pubKey.get() != remotePeerInfo.peerId.get().publicKey: + # debug "identify: Peer's remote public key doesn't match" + # raise newException(IdentityNoMatchError, + # "Peer's remote public key doesn't match") proc push*(p: Identify, conn: Connection) {.async.} = await conn.write(IdentifyPushCodec)