Skip to content

net: v2-only peer discovery (Q-49) - #132

Merged
reardencode merged 5 commits into
masterfrom
net/v2-discovery
Aug 18, 2026
Merged

net: v2-only peer discovery (Q-49)#132
reardencode merged 5 commits into
masterfrom
net/v2-discovery

Conversation

@rearden-grok

@rearden-grok rearden-grok Bot commented Aug 18, 2026

Copy link
Copy Markdown
Contributor

Why

Tip-follow and IBD were starved by v1-only DNS/addr gossip. We advertise
NETWORK|WITNESS|P2P_V2 and disconnect v1 after handshake, but discovery
still treated the network as dual-stack: bare seed names, NETWORK gossip
with service bits dropped, and take_dial_candidates(N) filling outbound
with known-INCOMPATIBLE IPs.

Closes Q-49.

What

  1. Dial: omit INCOMPATIBLE while any other candidate remains
    (FAILED_LAST_CONNECT stays retryable; all-incompat book is last-resort).
  2. Gossip: ingest addr/addrv2 only when
    (NETWORK || NETWORK_LIMITED) && P2P_V2.
  3. DNS names: dns_seed_query_host = Core x%x.<seed> for 0x809.
  4. Resolve: x809.<seed> first per seed; unfiltered name only if that
    is empty. No live DNS in the default suite.
  5. Docs: OPERATOR.md § P2P owns the contract; seed host list stays in
    seeds.rs. quality.md Q-49 → Completed.

Test plan

  • cargo test -p rbitcoin-net --lib take_dial_
  • cargo test -p rbitcoin-net --lib socket_addrs_from_addr_and_addrv2_filter
  • cargo test -p rbitcoin-net --lib dns_seed_query_host
  • cargo test -p rbitcoin-net --lib seed_lookup_names
  • cargo test -p rbitcoin-net --lib pick_seed_results
  • Required CI (fmt, deny, clippy, test, multinode, coverage)

Not a core-functional / static-binaries change.

rbitcoin-grok[bot] 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.
@reardencode
reardencode merged commit 89e25dd into master Aug 18, 2026
13 checks passed
@rearden-grok
rearden-grok Bot deleted the net/v2-discovery branch August 18, 2026 17:24
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