Skip to content

Commit

Permalink
Fix errors.
Browse files Browse the repository at this point in the history
  • Loading branch information
cheatfate committed Nov 25, 2024
1 parent 30658a0 commit 4248228
Showing 1 changed file with 10 additions and 5 deletions.
15 changes: 10 additions & 5 deletions libp2p/peerstore.nim
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@ import
./peerid,
./peerinfo,
./routing_record,
./multicodec,
./multiaddress,
./stream/connection,
./multistream,
Expand Down Expand Up @@ -155,13 +156,17 @@ proc updatePeerInfo*(
if observedAddr.isNone():
default(seq[MultiAddress])
else:
if TCP.match(observedAddr):
let res = observedAddr.get()
if TCP.match(res):
# We should form full P2P address in case of simple TCP address.
let p2p = MultiAddress.init(multiCodec("p2p"), info.peerId).valueOr:
raiseAssert "Should not be happen"
@[observedAddr.get() & p2p]
let
p2p = MultiAddress.init(multiCodec("p2p"), info.peerId).valueOr:
raiseAssert "Initialization should not fail"
ma = concat(res, p2p).valueOr:
raiseAssert "Concatenation should not fail"
@[ma]
else:
@[observedAddr.get()]
@[res]
addresses = info.addrs & observed

if len(addresses) > 0:
Expand Down

0 comments on commit 4248228

Please sign in to comment.