Skip to content
This repository was archived by the owner on Jun 26, 2023. It is now read-only.

Commit c46dd73

Browse files
chore: apply suggestions from code review
Co-Authored-By: Jacob Heun <[email protected]>
1 parent e4d4016 commit c46dd73

File tree

1 file changed

+7
-7
lines changed

1 file changed

+7
-7
lines changed

src/topology/multicodec-topology.js

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -55,20 +55,20 @@ class MulticodecTopology extends Topology {
5555

5656
/**
5757
* Update topology.
58-
* @param {Array<{id: PeerId, multiaddrs: Array<Multiaddr>}>} peerDataIterable
58+
* @param {Array<{id: PeerId, multiaddrs: Array<Multiaddr>, protocols: Array<string>}>} peerDataIterable
5959
* @returns {void}
6060
*/
6161
_updatePeers (peerDataIterable) {
62-
for (const peerData of peerDataIterable) {
63-
if (this.multicodecs.filter(multicodec => peerData.protocols.includes(multicodec)).length) {
62+
for (const { id, protocols } of peerDataIterable) {
63+
if (this.multicodecs.filter(multicodec => protocols.includes(multicodec)).length) {
6464
// Add the peer regardless of whether or not there is currently a connection
65-
this.peers.add(peerData.id.toB58String())
65+
this.peers.add(id.toB58String())
6666
// If there is a connection, call _onConnect
67-
const connection = this._registrar.getConnection(peerData.id)
68-
connection && this._onConnect(peerData.id, connection)
67+
const connection = this._registrar.getConnection(id)
68+
connection && this._onConnect(id, connection)
6969
} else {
7070
// Remove any peers we might be tracking that are no longer of value to us
71-
this.peers.delete(peerData.id.toB58String())
71+
this.peers.delete(id.toB58String())
7272
}
7373
}
7474
}

0 commit comments

Comments
 (0)