Open SgtPooki opened 1 year ago
It seems like a slight change to https://github.com/libp2p/js-libp2p-kad-dht/blob/94e42400f589954269fefc95d3c16442cdbb824a/src/peer-routing/index.ts#L199 could help, unless routingTable already includes only peers who speak my transports
I think we'd have to do some experimentation - it's a nice optimisation to only add peers that we can actually dial, but if you are a DHT server and another peer asks you for peers closer to a given KAD ID, you might have previously excluded peers that you can't dial, but that the querying peer can.
I’m on mobile and new to this codebase, but is it possible to only add peers to the peerDistanceList that have matching transports to the ones configured in libp2p?
it seems like the distance calculation has no awareness of peers that may not have valid (for my node) transports, which could easily result in filling up closestPeers to ‘this.capacity’ that I can’t talk to because they don’t talk the same transport as me.