mirror of
https://github.com/waku-org/nwaku.git
synced 2025-01-13 08:14:43 +00:00
chore: improving get_peer_ids_by_protocol by returning the available protocols of connected peers (#3109)
This commit is contained in:
parent
78759f6e52
commit
ed0ee5be20
@ -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("")
|
||||
|
Loading…
x
Reference in New Issue
Block a user