Skip to content

Conversation

@jacobheun
Copy link
Contributor

Currently getPeerId returns the first PeerId in the multiaddr. For most addresses this is fine. However, if a node is using a relay as an entrypoint, such as nodes running AutoRelay, getPeerId returns the id of the relay and not the destination peer.

For example the multiaddr, /ip4/0.0.0.0/tcp/8080/p2p/QmRelay/p2p-circuit/p2p/QmTarget, indicates that the target peer QmTarget is dialable over the relay peer QmRelay. Running getPeerId resolves QmRelay instead of QmTarget. The last peer id in the address should always be the target peer.

@jacobheun jacobheun requested a review from vasco-santos August 6, 2019 15:56
Copy link
Member

@vasco-santos vasco-santos left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good catch! LGTM

@jacobheun jacobheun merged commit c32071d into master Aug 7, 2019
@jacobheun jacobheun deleted the fix/getpeerid branch August 7, 2019 08:41
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants