net: v2-only peer discovery (Q-49) - #132
Merged
Merged
Conversation
added 5 commits
August 18, 2026 10:09
take_dial_candidates ranked last-resort last but still filled max with known-v1 IPs. A mixed book now omits INCOMPATIBLE until that set is the only leftover (FAILED_LAST_CONNECT stays retryable).
Gossip without the v2 bit is v1-only. We already disconnect those after handshake; keeping them in the book just starves outbound. Filter is (NETWORK || NETWORK_LIMITED) && P2P_V2.
BIP324 v2-only nodes should ask seeds for NETWORK|WITNESS|P2P_V2
(0x809), matching Core strprintf("x%x.%s", bits, seed). The hostname
helper is pure; resolve still uses the bare seed list.
Each DNS seed is queried as x809.<host> (NETWORK|WITNESS|P2P_V2). If that name is empty, the bare seed is tried so operators still bootstrap when a seed does not implement the x-filter. First success wins per seed; regtest stays empty.
OPERATOR owns the discovery contract (x809 seeds, P2P_V2 gossip, skip known-v1 while better addrs remain). Seed host list stays in seeds.rs. experimental-mainnet peer-scarcity points there.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Why
Tip-follow and IBD were starved by v1-only DNS/
addrgossip. We advertiseNETWORK|WITNESS|P2P_V2and disconnect v1 after handshake, but discoverystill treated the network as dual-stack: bare seed names,
NETWORKgossipwith service bits dropped, and
take_dial_candidates(N)filling outboundwith known-
INCOMPATIBLEIPs.Closes Q-49.
What
INCOMPATIBLEwhile any other candidate remains(
FAILED_LAST_CONNECTstays retryable; all-incompat book is last-resort).addr/addrv2only when(NETWORK || NETWORK_LIMITED) && P2P_V2.dns_seed_query_host= Corex%x.<seed>for0x809.x809.<seed>first per seed; unfiltered name only if thatis empty. No live DNS in the default suite.
OPERATOR.md§ P2P owns the contract; seed host list stays inseeds.rs.quality.mdQ-49 → Completed.Test plan
cargo test -p rbitcoin-net --lib take_dial_cargo test -p rbitcoin-net --lib socket_addrs_from_addr_and_addrv2_filtercargo test -p rbitcoin-net --lib dns_seed_query_hostcargo test -p rbitcoin-net --lib seed_lookup_namescargo test -p rbitcoin-net --lib pick_seed_resultsfmt,deny,clippy,test,multinode,coverage)Not a
core-functional/static-binarieschange.