Skip to content

fix(p2p): use connection remote addr as fallback when peerstore is empty - #5336

Merged
gacevicljubisa merged 2 commits into
masterfrom
fix-local-backwards
Jan 29, 2026
Merged

fix(p2p): use connection remote addr as fallback when peerstore is empty#5336
gacevicljubisa merged 2 commits into
masterfrom
fix-local-backwards

Conversation

@gacevicljubisa

@gacevicljubisa gacevicljubisa commented Jan 29, 2026

Copy link
Copy Markdown
Member

Checklist

  • I have read the coding guide.
  • My change requires a documentation update, and I have done it.
  • I have added tests to cover my changes.
  • I have filled out the description and linked the related issues.

Description

Fixes a backwards-compatibility bug affecting local nodes running v2.6.0 behind NAT without port forwarding.

Open API Spec Version Changes (if applicable)

Motivation and Context (Optional)

Related Issue (Optional)

Screenshots (if appropriate):

@janos janos left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

👍

Comment thread pkg/p2p/libp2p/libp2p.go
handshakeStream := newStream(stream, s.metrics)

peerMultiaddrs, err := s.peerMultiaddrs(s.ctx, peerID)
peerMultiaddrs, err := s.peerMultiaddrs(s.ctx, stream.Conn().RemoteMultiaddr(), peerID)

@akrem-chabchoub akrem-chabchoub Jan 29, 2026

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Is it always guaranteed that the stream.Conn() is not nil here ?

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

stream is always associated with a valid network.Conn, so this shouldn't happen

@gacevicljubisa
gacevicljubisa merged commit 9f2f7aa into master Jan 29, 2026
28 of 32 checks passed
@gacevicljubisa
gacevicljubisa deleted the fix-local-backwards branch January 29, 2026 12:07
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.

4 participants