-
Notifications
You must be signed in to change notification settings - Fork 63
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
getPeerId can return an unexpected peer id #319
Labels
Comments
achingbrain
changed the title
getPeerId can return the wrong peer id
getPeerId can return an unexpected peer id
Apr 14, 2023
achingbrain
added a commit
that referenced
this issue
May 11, 2023
If a p2p-circuit address doesn't contain the `/p2p/QmFoo` tuple for the target peer, `getPeerId` returns the peer id of the relay which is not what you'd expect. The fix here is for relay addresses, to return the peer id of the target and never the relay. Fixes #319
achingbrain
added a commit
that referenced
this issue
Jul 28, 2023
If a p2p-circuit address doesn't contain the `/p2p/QmFoo` tuple for the target peer, `getPeerId` returns the peer id of the relay which is not what you'd expect. The fix here is for relay addresses, to return the peer id of the target and never the relay. Fixes #319
🎉 This issue has been resolved in version 12.1.5 🎉 The release is available on: Your semantic-release bot 📦🚀 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
.getPeerId()
returns the peer id from a multiaddr if one is present but it may not be the one we expect.If the mulitaddr is a relay address but doesn't have the relay client's peer id in the address, the peer id returned is that of the relay.
I believe the intention of
.getPeerId
is to return the peer id of the remote peer that can be dialled using the peer id, not just any peer id that happens to be in the multiaddr.We could fix this by treating
p2p-circuit
as a special case and returning the value part of thep2p-circuit
tuple if found, or more generally by only returning a peer id if it's in the final tuple?Refs: libp2p/js-libp2p#1680
The text was updated successfully, but these errors were encountered: