Skip to content

chore(kad-dht): findPeerLocal to return undefined if no multiaddrs#3455

Open
dozyio wants to merge 3 commits into
libp2p:mainfrom
dozyio:fix-persistant-redialing
Open

chore(kad-dht): findPeerLocal to return undefined if no multiaddrs#3455
dozyio wants to merge 3 commits into
libp2p:mainfrom
dozyio:fix-persistant-redialing

Conversation

@dozyio
Copy link
Copy Markdown
Collaborator

@dozyio dozyio commented Apr 16, 2026

Description

Changes findPeerLocal so a peer with zero addresses is treated as a local miss.

  • dial calls calculateMultiaddrs to resolve dialable addresses.
  • When no addresses are available, calculateMultiaddrs throws NoValidAddressesError.
  • Previously, peer routing could return a local "hit" with empty addresses, so calculateMultiaddrs ended empty.
  • This change makes addressless local peers a cache miss in findPeerLocal, allowing a network lookup to repopulate addresses before calculateMultiaddrs gives up.

Change checklist

  • I have performed a self-review of my own code
  • I have made corresponding changes to the documentation if necessary (this includes comments as well)
  • I have added tests that prove my fix is effective or that my feature works

@dozyio dozyio marked this pull request as ready for review May 16, 2026 00:37
@dozyio dozyio requested a review from a team as a code owner May 16, 2026 00:37
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.

1 participant