net: check network activity in ThreadOpenConnections #36956

pull naiyoma wants to merge 2 commits into bitcoin:master from naiyoma:2026_5/fix_addrfecth changing 3 files +24 −19
  1. naiyoma commented at 7:00 PM on November 23, 2026: contributor

    Seednodes are used for addr-fetch connections. When the network is disabled (networkactive=0 or setnetworkactive false), the seednodes are consumed without ever being dialled and When the network becomes active again, no further addr-fetch attempts are made, even though the seednodes are still configured. They remain unavailable until the node is restarted.

    This happens because ThreadOpenConnections(), continues running its loop while the network is disabled. With < 2 outbound peers or an empty addrman, a seednode is popped from seed_nodes , queued as an addr-fetch, and then popped again from m_addr_fetches in ProcessAddrFetch(). It is then dropped because OpenNetworkConnection() returns early when the network is inactive. Once the network is re-enabled, no seednodes remain. Anchors were lost in the same way before #34213.

    This change makes ThreadOpenConnections wait while the network is re-enabled, as the way ThreadPrivateBroadcast does, so no connection state is used up while the network is disabled

  2. net: check network activity before attempting to create connections
    ThreadOpenConnections kept running its loop while the network was inactive.
    OpenNetworkConnection() refused every attempt, but by then the loop had
    already popped seednodes and addr-fetch entries, which were then lost.
    405ea4a6a3
  3. test: check that seednodes are kept while the network is inactive 31129ec13e
  4. DrahtBot added the label P2P on Nov 23, 2026
  5. DrahtBot commented at 7:00 PM on November 23, 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. A summary of reviews will appear here.

    <!--5faf32d7da4f0f540f40219e4f7537a3-->


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