Skip to content

Commit d43ceb5

Browse files
author
Alan Shaw
authored
fix: parameter to _onPeerDisconnected
`_onPeerDisconnected` is expecting a `PeerInfo` but it was being passed a pubsub `Peer`. I'm not sure if this is the correct fix but it resolves this error for me: ``` (node:77189) UnhandledPromiseRejectionWarning: TypeError: Cannot read property 'toB58String' of undefined at GossipSub._onPeerDisconnected (/Users/alan/Code/pl/ipfs/js-ipfs/node_modules/libp2p-pubsub/src/index.js:190:34) at GossipSub._processMessages (/Users/alan/Code/pl/ipfs/js-ipfs/node_modules/libp2p-gossipsub/src/pubsub.js:120:12) at runMicrotasks (<anonymous>) at processTicksAndRejections (internal/process/task_queues.js:94:5) ```
1 parent 8cc71a2 commit d43ceb5

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

src/pubsub.js

+2-2
Original file line numberDiff line numberDiff line change
@@ -98,7 +98,7 @@ class BasicPubSub extends Pubsub {
9898
* @override
9999
* @param {string} idB58Str peer id string in base58
100100
* @param {Connection} conn connection
101-
* @param {PeerInfo} peer peer info
101+
* @param {Peer} peer PubSub peer
102102
* @returns {void}
103103
*
104104
*/
@@ -117,7 +117,7 @@ class BasicPubSub extends Pubsub {
117117
}
118118
)
119119
} catch (err) {
120-
this._onPeerDisconnected(peer, err)
120+
this._onPeerDisconnected(peer.info, err)
121121
}
122122
}
123123

0 commit comments

Comments
 (0)