Skip to content
This repository has been archived by the owner on Jul 21, 2023. It is now read-only.

Feat: grant peerDistance awareness to libp2p transports #481

Open
SgtPooki opened this issue Jun 15, 2023 · 2 comments
Open

Feat: grant peerDistance awareness to libp2p transports #481

SgtPooki opened this issue Jun 15, 2023 · 2 comments

Comments

@SgtPooki
Copy link
Member

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.

@SgtPooki
Copy link
Member Author

It seems like a slight change to

await Promise.all(tablePeers.map(async peer => { await peers.add(peer) }))
could help, unless routingTable already includes only peers who speak my transports

@achingbrain
Copy link
Member

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.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants