What is idiomatic way to get peer's Multiaddr given we have its PeerId?
There exists get_authority_ids_by_peer_id which seems useful but when spinning up multiple nodes locally which connect to each other it always returns None
.
Digging into it, it seems internal addr_cache
(which holds PeerId
-> AuthorityId
-> Multiaddr
mappings) is only populated when handling DhtEvent::ValueFound(...)
which are not being emitted in my case.
Some background info on how I run nodes locally:
- spin up first node with
alice
account - spin up 4 more nodes using also predefined accounts by setting 1. as bootnode
Looking at node logs and invoking system_peers
RPC confirms nodes are connected with each other.
Update:
Seems like DhtEvent::ValueNotFound(...)
events are being emitted for corresponding Kademlia get_value
requests that authority-discovery
worker is creating. So it's probably problem with DHT not having proper entries initially.
MultiAddr
? You probably want theMultiaddr
of some random peer and not only from a validator?Multiaddr
for any peer in the network that I'm aware of i.e. for peers that are returned insystem_peers
RPC