test: ensure p2p_private_broadcast.py has connections to all nets #34410

pull vasild wants to merge 2 commits into bitcoin:master from vasild:test_private_broadcast_net_specific_connection changing 1 files +9 −1
  1. vasild commented at 12:05 pm on January 26, 2026: contributor

    If the following two events happen:

    • (likely) the automatic 10 initial connections are not made to all networks
    • (unlikely) the network-specific logic kicks in almost immediately. It is using exponential distribution with a mean of 5 minutes (rng.rand_exp_duration(EXTRA_NETWORK_PEER_INTERVAL)).

    So if both happen, then the 11th connection may not be the expected private broadcast, but a network-specific connection.

    Fix this by manually opening a connection to each network upfront. Before filling addrman, because once addrman has addresses the manual addnode connections will race with the automatic ones.

    Fixes: #34387

  2. test: ensure p2p_private_broadcast.py has connections to all nets
    If the following two events happen:
    
    * (likely) the automatic 10 initial connections are not made to all
      networks
    * (unlikely) the network-specific logic kicks in almost immediately.
      It is using exponential distribution with a mean of 5 minutes
      (`rng.rand_exp_duration(EXTRA_NETWORK_PEER_INTERVAL)`).
    
    So if both happen, then the 11th connection may not be the expected
    private broadcast, but a network-specific connection.
    
    Fix this by manually opening a connection to each network upfront.
    Before filling addrman, because once addrman has addresses the manual
    `addnode` connections will race with the automatic ones.
    
    Fixes: https://github.com/bitcoin/bitcoin/issues/34387
    590a7b2595
  3. test: use port 0 for I2P addresses in p2p_private_broadcast.py
    I2P addresses must use port=0, otherwise `bitcoind` refuses to connect.
    
    The test `p2p_private_broadcast.py` cannot simulate connections to I2P
    peers, so the I2P proxy is set to a dummy `127.0.0.1:1`. Still it is
    good to pick I2P addresses and attempt connections to increase coverage.
    
    However the test uses port=8333 for I2P addresses and thus the
    connection attempts fail for the "wrong" reason:
    
    ```
    Error connecting to ...i2p:8333, connection refused due to arbitrary port 8333
    ```
    
    Using the proper port=0 makes the failures:
    
    ```
    Error connecting to ...i2p:0: Cannot connect to 127.0.0.1:1
    ```
    
    which will make possible simulated I2P connections once we have a test
    I2P proxy.
    01757699f3
  4. DrahtBot added the label Tests on Jan 26, 2026
  5. DrahtBot commented at 12:05 pm on January 26, 2026: 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/34410.

    Reviews

    See the guideline for information on the review process. A summary of reviews will appear here.

  6. maflcko added this to the milestone 31.0 on Jan 26, 2026
  7. DrahtBot added the label CI failed on Jan 26, 2026
  8. fanquake commented at 2:15 pm on January 26, 2026: member
    Looks like this causes the test to timeout in most CIs. I see the same failure locally.


vasild DrahtBot fanquake

Labels
Tests CI failed

Milestone
31.0


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-01-27 06:13 UTC

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