test: add functional test for outbound connection management #33954

pull mzumsande wants to merge 2 commits into bitcoin:master from mzumsande:202511_test_outbound_mgmt changing 3 files +322 −1
  1. mzumsande commented at 7:01 pm on November 26, 2025: contributor

    For #29415, vasild added the possibility to have outbound connections made “naturally” by the node using addrman entries, by redirecting them via a SOCKS5 proxy to python p2ps or other full nodes, so that the node under test behaves as if it is connected to normal non-local peers from arbitrary networks, while we have full control over the peers.

    I think this feature is really cool and want to suggest to integrate it more prominently into the test framework ("auto_outbound_mode") in the first commit because it allows to test the code in which the node decides to make connections - in contrast to the existing add_outbound_p2p_connection where the functional test intiates the connections.

    The second commit uses it to add functional test coverage for the following features of outbound connection management:

    • extra full outbound connections due to a stale tip (#11560)
    • periodic block-relay-only connections (#19858)
    • full outbound connection management with respect to networks (#27213)

    This should work well with the test from #29415 (which would keep its own destinations_factory but can call _create_auto_outbound_listener to avoid much of code duplication).

    Other possible uses for auto_outbound_mode I could think of are more detailed testing of anchors (feature_anchors.py), feeler connections, or any other p2p logic that uses the network of peers.

  2. test: add auto_outbound_mode to test framework
    This new option allows tests to make use of automatic outbound connections
    (made from addrman).
    A SOCKS5 proxy is used to redirect the connection, for example to P2P test interfaces.
    
    For advanced customization, tests can override the destinations_factory
    in setup_network() and use the _create_addrman_listener() helper method
    to handle connections in a test-specific way.
    
    Co-authored-by: Vasil Dimov <vd@FreeBSD.org>
    a17e664cbc
  3. DrahtBot added the label Tests on Nov 26, 2025
  4. DrahtBot commented at 7:01 pm on November 26, 2025: contributor

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

    Code Coverage & Benchmarks

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

    Reviews

    See the guideline for information on the review process.

    Type Reviewers
    Concept ACK vasild

    If your review is incorrectly listed, please copy-paste <!–meta-tag:bot-skip–> into the comment that the bot should ignore.

  5. test: add functional test for outbound connection management
    The test covers
    - Extra outbound connections when the tip is stale
    - Regularly scheduled extra block-relay-only connections
    - Management of full outbound connection slots with respect to network-specific peers
    1158564303
  6. mzumsande force-pushed on Nov 26, 2025
  7. DrahtBot added the label CI failed on Nov 26, 2025
  8. DrahtBot removed the label CI failed on Nov 26, 2025
  9. mzumsande marked this as ready for review on Nov 26, 2025
  10. vasild commented at 9:22 am on November 27, 2025: contributor
    Concept ACK, thanks!
  11. mzumsande marked this as a draft on Nov 28, 2025
  12. mzumsande commented at 10:08 pm on November 28, 2025: contributor
    there are still some intermittent timeouts, will put in draft until I’ve fixed them.

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: 2025-12-01 21:13 UTC

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