mirror of
https://github.com/waku-org/nwaku.git
synced 2025-01-29 16:15:54 +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)
|
return ok(peerIDs)
|
||||||
of GET_PEER_IDS_BY_PROTOCOL:
|
of GET_PEER_IDS_BY_PROTOCOL:
|
||||||
## returns a comma-separated string of peerIDs that mount the given protocol
|
## returns a comma-separated string of peerIDs that mount the given protocol
|
||||||
let (inPeers, outPeers) = waku.node.peerManager.connectedPeers($self[].protocol)
|
let connectedPeers = waku.node.peerManager.wakuPeerStore
|
||||||
let allPeerIDs = inPeers & outPeers
|
.peers($self[].protocol)
|
||||||
return ok(allPeerIDs.join(","))
|
.filterIt(it.connectedness == Connected)
|
||||||
|
.mapIt($it.peerId)
|
||||||
|
.join(",")
|
||||||
|
return ok(connectedPeers)
|
||||||
|
|
||||||
return ok("")
|
return ok("")
|
||||||
|
Loading…
x
Reference in New Issue
Block a user