p2p: Assume v2transport for addresses from seeds #35766

pull mzumsande wants to merge 1 commits into bitcoin:master from mzumsande:202607_seeds_v2 changing 2 files +10 −2
  1. mzumsande commented at 5:01 PM on July 21, 2026: contributor

    gmaxwell noted in #30951 (comment) that addresses loaded from dns seeds and fixed seeds are still assumed to be v1, so a new node won't use v2transport for the first few connections it makes. By now, the vast majority of reachable nodes (~80% according to https://bitnod.es/) in the network supports BIP324, and even if the optimistic guess would turn out to be wrong for a given node, we would just reconnect with v1. This would also be necessary for a v2-only option (#30951), but I think it makes sense to change the default regardless of that PR. Note that -seednode and addr-fetch connections already use v2transport by default.

  2. p2p: Assume v2transport for addresses from seeds
    By now, the vast majority of nodes in the network supports BIP324.
    Even if the optimistic guess would turn out to be wrong for a given
    node, we would just reconnect with v1.
    This is better than making v1 connections with peers when both nodes support v2.
    cf0f2aeae0
  3. DrahtBot added the label P2P on Jul 21, 2026
  4. DrahtBot commented at 5:01 PM on July 21, 2026: contributor

    <!--e57a25ab6845829454e8d69fc972939a-->

    The following sections might be updated with supplementary metadata relevant to reviewers and maintainers.

    <!--006a51241073e994b41acfe9ec718e94-->

    Code Coverage & Benchmarks

    For details see: https://corecheck.dev/bitcoin/bitcoin/pulls/35766.

    <!--021abf342d371248e50ceaed478a90ca-->

    Reviews

    See the guideline and AI policy for information on the review process.

    Type Reviewers
    ACK w0xlt, sedited, willcl-ark, stratospher
    Concept ACK darosior, gmaxwell

    If your review is incorrectly listed, please copy-paste <code>&lt;!--meta-tag:bot-skip--&gt;</code> into the comment that the bot should ignore.

    <!--5faf32d7da4f0f540f40219e4f7537a3-->

  5. sedited commented at 5:17 PM on July 21, 2026: contributor

    Nice, Concept ACK

  6. darosior commented at 5:50 PM on July 21, 2026: member

    Concept ACK.

  7. in src/protocol.h:374 in cf0f2aeae0
     369 | + * Service flags we assume for addresses obtained from the DNS seeds and the
     370 | + * fixed seeds, which don't come with service flags attached.
     371 | + * BIP324 support can be safely assumed because the vast majority of listening nodes signals NODE_P2P_V2, and if the
     372 | + * assumption is wrong for a given peer we simply reconnect using v1 transport.
     373 | + */
     374 | +constexpr ServiceFlags SeedsAssumedServiceFlags() { return ServiceFlags(SeedsServiceFlags() | NODE_P2P_V2); }
    


    darosior commented at 6:15 PM on July 21, 2026:

    What's the reason for keeping SeedsServiceFlags() around now that it's only called by this function?


    mzumsande commented at 6:42 PM on July 21, 2026:

    It determines the required flags that we ask the DNS seeds for, see https://github.com/mzumsande/bitcoin/blob/cf0f2aeae009c98615bffd4dafd74e46f20a0ae6/src/net.cpp#L2389. We don't require NODE_P2P_V2 from the seeds because it is not necessary - v1 nodes can continue to be returned from seeds because we can downgrade.


    darosior commented at 7:02 PM on July 21, 2026:

    Right, should have actually read the code before commenting.

  8. gmaxwell commented at 8:38 PM on July 21, 2026: contributor

    utACK

  9. w0xlt commented at 10:45 PM on July 21, 2026: contributor

    ACK cf0f2aeae009c98615bffd4dafd74e46f20a0ae6

  10. DrahtBot requested review from darosior on Jul 21, 2026
  11. DrahtBot requested review from sedited on Jul 21, 2026
  12. sedited requested review from stratospher on Jul 22, 2026
  13. sedited approved
  14. sedited commented at 8:01 AM on July 22, 2026: contributor

    ACK cf0f2aeae009c98615bffd4dafd74e46f20a0ae6

  15. fanquake added this to the milestone 32.0 on Jul 22, 2026
  16. willcl-ark approved
  17. willcl-ark commented at 10:46 AM on July 22, 2026: member

    ACK cf0f2aeae009c98615bffd4dafd74e46f20a0ae6

    makes sense to be optimistic here, as we fallback gracefully already.

  18. stratospher approved
  19. stratospher commented at 12:46 PM on July 22, 2026: contributor

    tested ACK cf0f2aea.

  20. fanquake merged this on Jul 22, 2026
  21. fanquake closed this on Jul 22, 2026

  22. darosior commented at 1:49 PM on July 22, 2026: member

    I think it makes sense to backport. It's a tiny patch that is also relevant for previous maintained versions.

  23. fanquake commented at 2:06 PM on July 22, 2026: member

    Backported to 31.x in #35699.

  24. fanquake referenced this in commit c02ff3e793 on Jul 22, 2026
  25. fanquake commented at 4:08 PM on July 22, 2026: member

    Backported to 30.x in #35710.

  26. fanquake referenced this in commit 28234bd827 on Jul 22, 2026
  27. mzumsande deleted the branch on Jul 22, 2026
  28. sipa commented at 11:33 PM on July 22, 2026: member

    Posthumous Concept ACK


github-metadata-mirror

This is a metadata mirror of the GitHub repository bitcoin/bitcoin. This site is not affiliated with GitHub. Content is generated from a GitHub metadata backup.
generated: 2026-08-11 11:51 UTC

This site is hosted by @0xB10C
More mirrored repositories can be found on mirror.b10c.me