test: fix addr relay test silently passing and other improvements #34750

pull stratospher wants to merge 3 commits into bitcoin:master from stratospher:2026_03_tests_addr_relay changing 2 files +20 −9
  1. stratospher commented at 5:58 am on March 6, 2026: contributor

    couple of improvements in the addr relay test:

    • fixes the silent test pass discovered in #34717 (comment) (will remove this if that PR gets merged - the test doesn’t fail even though #34717 changes the behaviour)
    • correct wrong peerinfo index
    • prevent intermittent disconnection warnings like the one shown below by protecting outbound peer from ConsiderEviction
    0  TestFramework (INFO): Check that we answer getaddr messages only once per connection
    1  TestFramework.p2p (WARNING): Connection lost to 127.0.0.1:58829 due to [Errno 54] Connection reset by peer
    
    • remove a no longer applicable test comment since we don’t need to send initial GETADDR for intial self announcement anymore
  2. test: fix addr relay test silent pass and wrong peerinfo index
    the test silently passes on master because SetupAddressRelay
    isn't called by default for inbound connections.
    ecb5ce6e76
  3. test: protect outbound connection from eviction in getaddr_test
    since we're bumping mocktime more than CHAIN_SYNC_TIMEOUT = 20 * 60,
    it's possible for disconnections like this to happen in the test:
    
    $ test/functional/p2p_addr_relay.py --randomseed=7758649581790797022
    ...
    TestFramework (INFO): Check that we answer getaddr messages only once per connection
    TestFramework.p2p (WARNING): Connection lost to 127.0.0.1:58829 due to [Errno 54] Connection reset by peer
    ...
    7ee8c0abc6
  4. test: use static methods and clarify comment in addr_relay
    we don't need to send GETADDR for initial self announcement
    anymore + can construct addr_receivers using
    AddrReceiver(send_getaddr=False).
    
    however we would need to send an empty ADDR message to each
    of the addr_receivers to initialise addr relay for inbound
    connections. so current code is simpler and we can just
    clarify the comment.
    57bfa864fe
  5. DrahtBot added the label Tests on Mar 6, 2026
  6. DrahtBot commented at 5:58 am on March 6, 2026: contributor

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

    Reviews

    See the guideline for information on the review process.

    Type Reviewers
    ACK Bortlesboat

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

    Conflicts

    Reviewers, this pull request conflicts with the following ones:

    • #34717 (p2p: remove m_getaddr_sent by naiyoma)

    If you consider this pull request important, please also help to review the conflicting pull requests. Ideally, start with the one that should be merged first.

  7. DrahtBot added the label CI failed on Mar 6, 2026
  8. stratospher commented at 7:12 am on March 6, 2026: contributor
    (CI failure is unrelated)
  9. fanquake added this to the milestone 31.0 on Mar 6, 2026
  10. DrahtBot removed the label CI failed on Mar 6, 2026
  11. Bortlesboat commented at 6:10 pm on March 6, 2026: none

    utACK 57bfa864fe

    The move of msg_addr() before the relay check is the key fix — without it, the num_ipv4_received == 0 assertion was passing because address relay was never initialized, not because relay was actually suppressed.

    The peerinfo index fix and header announcement to prevent eviction are straightforward.

  12. Bortlesboat commented at 7:14 pm on March 8, 2026: none
    ACK 57bfa864fe69. Ran both p2p_addr_relay.py and p2p_addr_selfannouncement.py locally, both pass. Good catch on the stale peerinfo reference in inbound_blackhole_tests — that would silently check the wrong peer.


stratospher DrahtBot Bortlesboat

Labels
Tests

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-03-09 09:13 UTC

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