Skip to content

Commit

Permalink
chore: improving get_peer_ids_by_protocol by returning the available …
Browse files Browse the repository at this point in the history
…protocols of connected peers (#3109)
  • Loading branch information
gabrielmer authored Oct 11, 2024
1 parent 78759f6 commit ed0ee5b
Showing 1 changed file with 6 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -81,8 +81,11 @@ proc process*(
return ok(peerIDs)
of GET_PEER_IDS_BY_PROTOCOL:
## returns a comma-separated string of peerIDs that mount the given protocol
let (inPeers, outPeers) = waku.node.peerManager.connectedPeers($self[].protocol)
let allPeerIDs = inPeers & outPeers
return ok(allPeerIDs.join(","))
let connectedPeers = waku.node.peerManager.wakuPeerStore
.peers($self[].protocol)
.filterIt(it.connectedness == Connected)
.mapIt($it.peerId)
.join(",")
return ok(connectedPeers)

return ok("")

0 comments on commit ed0ee5b

Please sign in to comment.