feat: only dial a peer if it has a wss multiaddr

This commit is contained in:
Arseniy Klempner 2024-04-25 22:15:02 -07:00
parent 73d78aa0ad
commit 0ffce07924
No known key found for this signature in database
GPG Key ID: 51653F18863BD24B
1 changed files with 11 additions and 0 deletions

View File

@ -456,6 +456,17 @@ export class ConnectionManager
return false;
}
const peer = await this.libp2p.peerStore.get(peerId);
if (
!peer.addresses.some((val) => val.multiaddr.toString().includes("/wss/"))
) {
log.info(
`Peer ${peerId.toString()} does not have a multiaddr that supports wss, not dialing.`
);
return false;
}
// if the peer is not part of any of the configured pubsub topics, don't dial
if (!(await this.isPeerTopicConfigured(peerId))) {
const shardInfo = await this.getPeerShardInfo(