temporary fix, until pub/priv keys are Option[T]

This commit is contained in:
Dmitriy Ryajov 2019-09-12 15:57:36 -06:00
parent 72c4115c95
commit f39a5cf5e4
1 changed files with 9 additions and 6 deletions

View File

@ -70,6 +70,7 @@ proc decodeMsg*(buf: seq[byte]): IdentifyInfo =
var pubKey: PublicKey var pubKey: PublicKey
if pb.getValue(1, pubKey) > 0: if pb.getValue(1, pubKey) > 0:
result.pubKey = some(pubKey) result.pubKey = some(pubKey)
debug "PUBKEY", pubKey = pubKey
result.addrs = newSeq[MultiAddress]() result.addrs = newSeq[MultiAddress]()
var address = newSeq[byte]() var address = newSeq[byte]()
@ -123,12 +124,14 @@ proc identify*(p: Identify,
result = decodeMsg(message) result = decodeMsg(message)
debug "identify: Identify for remote peer succeded" debug "identify: Identify for remote peer succeded"
if remotePeerInfo.peerId.isSome and # TODO: To enable the blow code, the private and public
result.pubKey.isSome and # keys in PeerID need to be wrapped with Option[T]
result.pubKey.get() != remotePeerInfo.peerId.get().publicKey: # if remotePeerInfo.peerId.isSome and
debug "identify: Peer's remote public key doesn't match" # result.pubKey.isSome and
raise newException(IdentityNoMatchError, # result.pubKey.get() != remotePeerInfo.peerId.get().publicKey:
"Peer's remote public key doesn't match") # 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.} = proc push*(p: Identify, conn: Connection) {.async.} =
await conn.write(IdentifyPushCodec) await conn.write(IdentifyPushCodec)