From 0ffce0792480c87f6466a1df07cd42998d0e2851 Mon Sep 17 00:00:00 2001 From: Arseniy Klempner Date: Thu, 25 Apr 2024 22:15:02 -0700 Subject: [PATCH] feat: only dial a peer if it has a wss multiaddr --- packages/core/src/lib/connection_manager.ts | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/packages/core/src/lib/connection_manager.ts b/packages/core/src/lib/connection_manager.ts index 1692154f5c..18de62c9ee 100644 --- a/packages/core/src/lib/connection_manager.ts +++ b/packages/core/src/lib/connection_manager.ts @@ -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(