From 5959fe4a2cac562f5d08b1cbf36cb090e47f4c3e Mon Sep 17 00:00:00 2001 From: danisharora099 Date: Wed, 10 Jan 2024 17:52:37 +0530 Subject: [PATCH] rm: comments --- packages/utils/src/libp2p/index.ts | 52 ------------------------------ 1 file changed, 52 deletions(-) diff --git a/packages/utils/src/libp2p/index.ts b/packages/utils/src/libp2p/index.ts index 2493fe498e..44de86d0e4 100644 --- a/packages/utils/src/libp2p/index.ts +++ b/packages/utils/src/libp2p/index.ts @@ -49,37 +49,6 @@ export async function selectLowestLatencyPeer( : undefined; } -// /** -// * Returns the list of peers that supports the given protocol and shard. -// * If shard is not configured, all peers that support the protocol are returned. -// */ - -// export async function getPeersForProtocolAndShard( -// peerStore: PeerStore, -// protocols: string[], -// shardInfo?: ShardInfo -// ): Promise { -// const peers: Peer[] = []; -// await peerStore.forEach((peer) => { -// if (shardInfo) { -// const encodedPeerShardInfo = peer.metadata.get("shardInfo"); -// const peerShardInfo = -// encodedPeerShardInfo && decodeRelayShard(encodedPeerShardInfo); - -// if (peerShardInfo && shardInfo.clusterId === peerShardInfo.clusterId) { -// if (protocols.some((protocol) => peer.protocols.includes(protocol))) { -// peers.push(peer); -// } -// } -// } else { -// if (protocols.some((protocol) => peer.protocols.includes(protocol))) { -// peers.push(peer); -// } -// } -// }); -// return peers; -// } - /** * Returns the list of peers that supports the given protocol. */ @@ -99,27 +68,6 @@ export async function getPeersForProtocol( return peers; } -// export async function getConnectedPeersForProtocol( -// connections: Connection[], -// peerStore: PeerStore, -// protocols: string[] -// ): Promise { -// const openConnections = connections.filter( -// (connection) => connection.status === "open" -// ); - -// const peerPromises = openConnections.map(async (connection) => { -// const peer = await peerStore.get(connection.remotePeer); -// const supportsProtocol = peer.protocols.some((protocol) => -// protocols.includes(protocol) -// ); -// return supportsProtocol ? peer : null; -// }); - -// const peersWithNulls = await Promise.all(peerPromises); -// return peersWithNulls.filter((peer): peer is Peer => peer !== null); -// } - export async function getConnectedPeersForProtocolAndShard( connections: Connection[], peerStore: PeerStore,