test: Fix wait_for_getheaders() call in test_outbound_eviction_blocks_relay_only() #32823

pull pablomartin4btc wants to merge 2 commits into bitcoin:master from pablomartin4btc:test_p2p_outbound_eviction_block_relay_fix changing 1 files +15 −13
  1. pablomartin4btc commented at 5:24 pm on June 27, 2025: member

    This change avoids relying on tip_header.hash, which is None when the header is deserialized from hex during CBlockHeader() construction. Instead, tip_header.rehash() explicitly computes the hash, making the test behavior more robust.

    Using the explicit rehash() avoids depending on wait_for_getheaders() falling back to any received message, thus making the test more deterministic.

    This is a follow-up to #32742.

    Also, as noted in a previous review comment, “the hash field is wrong either way, simply due to being the wrong type (it is an optional hex string), as opposed to an optional int”.


    The first commit intention is to improve clarity around the tests purpose, helping reviewers follow what’s being verified and why. What started as a small comment during review of #32742 led me reviewing and try to improve most relevant tests comments for consistency and correctness.

  2. test: Clarify roles in outbound eviction comments
    Some ambiguous uses of "we" referring to either the node or the peer are replaced with clearer phrasing.
    
    Also rephrase some comments for consistency and readability.
    
    Applies to all relevant outbound eviction tests in p2p_eviction_logic.py.
    26598ed21e
  3. test: Use rehash() in outbound eviction block-relay
    Ensure that tip_header.rehash() is used instead of tip_header.hash, which is None when the header is deserialized from hex.
    
    This avoids depending on wait_for_getheaders() falling back to any received message, making the test more explicit and robust.
    ec004cdb86
  4. DrahtBot added the label Tests on Jun 27, 2025
  5. DrahtBot commented at 5:24 pm on June 27, 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/32823.

    Reviews

    See the guideline for information on the review process.

    Type Reviewers
    ACK theStack, yuvicc, danielabrozzoni, achow101

    If your review is incorrectly listed, please react with 👎 to this comment and the bot will ignore it on the next update.

  6. fanquake requested review from theStack on Jun 30, 2025
  7. theStack approved
  8. theStack commented at 10:30 pm on June 30, 2025: contributor

    lgtm ACK ec004cdb86e6471915e1033f390c76ee0428e415 :hash:

    The second commit is a test bugfix very similar to #32742 / dd8447f70faf6419b4617da3c1b57098e9cd66a6 and should be backported (fwiw, I checked all other wait_for_... calls with hash parameters in this test file and think we caught them all now). The other commit improves the code comments w.r.t. consistent peer/node naming and getting rid of the “we” phrasing, agree that this is clearer now.

  9. yuvicc commented at 4:52 am on July 1, 2025: contributor

    ACK ec004cdb86e6471915e1033f390c76ee0428e415

    • some comments has been updated to maintain readability
    • update wait_for_getheader to use rehash() for robust testing
  10. danielabrozzoni commented at 12:26 pm on July 1, 2025: contributor

    ACK ec004cdb86e6471915e1033f390c76ee0428e415

    Code looks good to me, I like the rephrasing of the comments, the test is easier to follow now :)

  11. achow101 commented at 8:30 pm on July 2, 2025: member
    ACK ec004cdb86e6471915e1033f390c76ee0428e415
  12. achow101 merged this on Jul 2, 2025
  13. achow101 closed this on Jul 2, 2025

  14. fanquake referenced this in commit f82015ccfc on Jul 3, 2025
  15. fanquake referenced this in commit 3a57bfaaf9 on Jul 3, 2025
  16. fanquake commented at 11:16 am on July 3, 2025: member
    Backported to 29.x in #32863.

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-07-23 00:13 UTC

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