Skip to content

fix(autonat): dial first address in multi-address DialRequest#6514

Open
akshitj11 wants to merge 3 commits into
libp2p:masterfrom
akshitj11:fix/6482-autonat-addr-idx
Open

fix(autonat): dial first address in multi-address DialRequest#6514
akshitj11 wants to merge 3 commits into
libp2p:masterfrom
akshitj11:fix/6482-autonat-addr-idx

Conversation

@akshitj11

@akshitj11 akshitj11 commented Jul 10, 2026

Copy link
Copy Markdown

Description

Fixes #6482.

The AutoNAT v2 server selected the last address via addrs.pop() but always reported addr_idx = 0. Selection now uses the first priority-ordered address and reports its index.

Attestation:

  • I have read every line of this diff, understand what it does, and can explain it in review.

Notes & open questions

None.

Change checklist

  • I have performed a self-review of my own code
  • I have made corresponding changes to the documentation
  • I have added tests that prove my fix is effective or that my feature works
  • A changelog entry has been made in the appropriate crates

@akshitj11

Copy link
Copy Markdown
Author

Updated the selection helper so the chosen address and addr_idx come from the same filtered iteration. Added a regression case where only a nonzero address index is accepted, plus a refusal case when no address is accepted.

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.

autonat v2 server tests the last requested address but always reports addr_idx 0

1 participant