Skip to content
This repository was archived by the owner on Feb 12, 2024. It is now read-only.

Commit 897590a

Browse files
jacobheunalanshaw
and
alanshaw
authored
fix: update peer info before conditionally dialing
When we discover a peer, we may not have the latest information from our PeerBook, such as the connected multiaddress. Doing peerBook.put handles merging this information and the new PeerInfo instance is returned. Updating the peerInfo instance, before performing a check, should make sure we have the correct information. Co-Authored-By: alanshaw <[email protected]>
1 parent 335c6af commit 897590a

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

src/core/components/libp2p.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ module.exports = function libp2p (self, config) {
2020
let discoveredPeers = []
2121

2222
const putAndDial = peerInfo => {
23-
peerBook.put(peerInfo)
23+
peerInfo = peerBook.put(peerInfo)
2424
if (!peerInfo.isConnected()) {
2525
libp2p.dial(peerInfo, () => {})
2626
}

0 commit comments

Comments
 (0)