addrman: don't stall feelers when a tried collision is unreachable #36932

pull naiyoma wants to merge 2 commits into bitcoin:master from naiyoma:2026_5/fix_feelers_unreachable_collision changing 5 files +77 −23
  1. naiyoma commented at 7:35 PM on November 20, 2026: contributor

    When the old entry in a collision is unreachable and hasn't connected successfully in the last 4 hours, it can only leave the collision set through the 40-minute ADDRMAN_TEST_WINDOW branch. Until then, if it's the only pending collision, no feeler connections are made at all. This is a rare occurrence I ran into when I switched from dual-homed (IPv4 + Tor) to -onlynet=ipv4.

    ThreadOpenConnections() repeatedly calls SelectTriedCollision(), which keeps returning the unreachable entry. Since its network is unreachable, the entry is skipped without making a connection. nTries eventually runs out without any feeler connections being made. The same process repeats on subsequent feeler turns until ResolveCollisions() resolves the collision after ADDRMAN_TEST_WINDOW (40 minutes).

    This PR passes the reachable networks to SelectTriedCollision(), so it only returns collisions whose to-be-evicted entry belongs to a reachable network. If none of the pending collisions qualify, nothing is returned, and a regular feeler connection is made instead.

    Another approach I considered 2 is to overwrite unreachable tried entries involved in a collision directly in ResolveCollisions().

  2. addrman: add networks filter to SelectTriedCollision
    If networks is non-empty, SelectTriedCollision() starts at a random
    collision and returns the first one whose to-be-evicted entry is on one
    of the given networks, or nothing if there is none. Skipped collisions
    are kept.
    99f5a0074c
  3. net: only test tried collisions on reachable networks with feelers
    Pass reachable_nets to SelectTriedCollision() so that a pending
    collision that can't be tested no longer stops feeler connections:
    a regular feeler is made instead until ResolveCollisions() replaces
    it after ADDRMAN_TEST_WINDOW.
    fc9f536d17
  4. DrahtBot added the label P2P on Nov 20, 2026
  5. DrahtBot commented at 7:35 PM on November 20, 2026: contributor

    <!--e57a25ab6845829454e8d69fc972939a-->

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

    <!--006a51241073e994b41acfe9ec718e94-->

    External sites

    <!--021abf342d371248e50ceaed478a90ca-->

    Reviews

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

    Type Reviewers
    Concept ACK mzumsande

    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-->

  6. mzumsande commented at 7:05 PM on December 2, 2026: contributor

    Concept ACK

    On the question of whether to replace now or wait for 40 minutes and replace then: I think that reachability can change while bitcoind is running only for the tor network (torcontrol). In all other cases, the existing entry would get overwritten eventually anyway. On the other hand, waiting a bit also doesn't hurt, since this is not time critical.

    Passing a list of networks to SelectTriedCollision could prove helpful also in another branch I am currently working on with @stratospher, so having that could come in handy.

Labels

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-12-05 04:51 UTC

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