#36152 test: cover the feature-negotiation version boundary in p2p_leak
https://github.com/bitcoin/bitcoin/pull/36152 · · +26/-1 in 2 files, 2 commits · labels: Tests
Goal
- Prevent regressions in P2P feature negotiation at the version boundary
- Ensure peers connecting at version 70016 receive expected negotiation messages
This pull request adds boundary test coverage in test/functional/p2p_leak.py and test/functional/p2p_sendtxrcncl.py for peers connecting with nVersion == 70016 (WTXID_RELAY_VERSION). It asserts that WTXIDRELAY, SENDADDRV2, and SENDTXRCNCL messages are delivered at this exact version boundary, killing mutation testing survivals.
Problem: Existing functional tests checked that pre-wtxidrelay peers (nVersion 70015) do not receive WTXIDRELAY, SENDADDRV2, or SENDTXRCNCL, but no test asserted that peers at the lower boundary of 70016 receive them. A regression changing the comparison from >= to > would not be caught.
Category: P2P (#61 of 65)
P4 · test coverage
- P4 because it only adds boundary test coverage for long-established protocol version checks
- Prevents off-by-one comparison regressions surfaced by mutation testing
P4 because it only adds boundary test coverage for long-established protocol version checks in functional tests. The description notes it pins down the boundary so that 'an off-by-one change of either greatest_common_version >= WTXID_RELAY_VERSION / >= 70016 comparison to > is detected' and kills mutations in net_processing.cpp.
Membership: Tests feature negotiation messages (WTXIDRELAY, SENDADDRV2, SENDTXRCNCL) and peer version handling in net_processing.
Factors: security/stability 0, bug 0, performance 0, user value 0, leverage 0
Reviewability: Ready
- Ready to review
The patch is small, cleanly rebased, passes CI, and has already incorporated reviewer feedback.
Author status: active
Resolved concerns:
- naiyoma suggested expanding the PR to also cover the SENDTXRCNCL version check at net_processing.cpp#3466, which the author incorporated via a second commit co-authored with naiyoma.
Agreement: Positive
- Concept approval with suggestion to extend coverage to SENDTXRCNCL (naiyoma)
- Verified by testing on macOS (Marisha-Sahay)
Positive with concept approval from naiyoma and a tested ACK from Marisha-Sahay
Reviewers welcomed the mutation kill; naiyoma suggested extending it to SENDTXRCNCL which the author implemented, followed by a tested ACK from Marisha-Sahay.
- naiyoma: Concept ACK, suggested covering line 3466 in net_processing.cpp
- brunoerg: incorporated the suggestion and force-pushed
- Marisha-Sahay: tACK after testing on macOS
Review verdicts (DrahtBot): 1
- ACK: Marisha-Sahay
- Concept ACK: naiyoma
Files
27 lines under test/bench/ci.
- test/functional/p2p_leak.py +14/-1
- test/functional/p2p_sendtxrcncl.py +12/-0
Card
Adds boundary assertions for protocol version 70016 in p2p_leak.py and p2p_sendtxrcncl.py. This ensures that WTXIDRELAY, SENDADDRV2, and SENDTXRCNCL are confirmed sent at WTXID_RELAY_VERSION, closing mutation testing gaps against off-by-one regressions. The change is small, self-contained, and has a Concept ACK and a tested ACK.