js-libp2p icon indicating copy to clipboard operation
js-libp2p copied to clipboard

peerRouting.getClosestPeers is not compatible with KadDHT router

Open greenSnot opened this issue 4 years ago • 0 comments

  • Version: 0.32.4
  • Platform: UNIX
  • Subsystem: js-libp2p-kad-dht: 0.23.2

Severity: High

Description:

Once peerRouting.getClosestPeers is called, following errors occured. libp2p:peer-store:address-book:err peerId must be an instance of peer-id to store data... libp2p:peer-routing:err Error: peerId must be an instance of peer-id...

libp2p.peerRouting.getClosestPeers requires the router returning AsyncIterable<{ id: PeerId, multiaddrs: Multiaddr[] }> https://github.com/libp2p/js-libp2p/blob/d3f78edffeedd46a739605ca834d49565c86b74e/src/peer-routing.js#L143

but KadDHT.peerRouting.getClosestPeers returns AsyncIterable<PeerId> https://github.com/libp2p/js-libp2p-kad-dht/blob/57f40295769b0f3b0341b8925b32c0a764709b91/src/peer-routing/index.js#L231

greenSnot avatar Aug 29 '21 11:08 greenSnot