test: cover the feature-negotiation version boundary in p2p_leak #36152

Manually merged
brunoerg merged 2 commits from 2026-09-test-wtxidrelay-version-boundary into master 2026-10-06 08:10:35 +00:00 AGit
brunoerg commented 2026-09-02 18:10:54 +00:00 (Migrated from github.com)

p2p_leak already checks that a pre-wtxidrelay peer (nVersion 70015) is sent neither WTXIDRELAY nor SENDADDRV2, but nothing pins down the exact boundary: the feature negotiation messages are offered when the common version is >= WTXID_RELAY_VERSION (70016).

Add a peer advertising exactly 70016 and assert it receives both messages, so an off-by-one change of either greatest_common_version >= WTXID_RELAY_VERSION / >= 70016 comparison to > is detected.

It kills https://bitcoincore.space/src/net_processing.cpp#3462 and https://bitcoincore.space/src/net_processing.cpp#3464


edit: added a commit that adds a test case that checks SENDTXRCNCL is sent at version 70016. The existing 70015 case only shows SENDTXRCNCL is withheld below the wtxidrelay version. Add a peer at exactly 70016 so the lower bound of the >= WTXID_RELAY_VERSION check is covered too. It kills: https://bitcoincore.space/src/net_processing.cpp#3466.

p2p_leak already checks that a pre-wtxidrelay peer (nVersion 70015) is sent neither WTXIDRELAY nor SENDADDRV2, but nothing pins down the exact boundary: the feature negotiation messages are offered when the common version is >= WTXID_RELAY_VERSION (70016). Add a peer advertising exactly 70016 and assert it receives both messages, so an off-by-one change of either `greatest_common_version >= WTXID_RELAY_VERSION` / `>= 70016` comparison to `>` is detected. It kills https://bitcoincore.space/src/net_processing.cpp#3462 and https://bitcoincore.space/src/net_processing.cpp#3464 ----- edit: added a commit that adds a test case that checks `SENDTXRCNCL` is sent at version 70016. The existing 70015 case only shows SENDTXRCNCL is withheld below the wtxidrelay version. Add a peer at exactly 70016 so the lower bound of the `>= WTXID_RELAY_VERSION` check is covered too. It kills: https://bitcoincore.space/src/net_processing.cpp#3466.
DrahtBot commented 2026-09-02 18:11:02 +00:00 (Migrated from github.com)

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

External sites

Reviews

See the guideline and AI policy for information on the review process.

Type Reviewers
ACK Marisha-Sahay, naiyoma, sedited

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

<!--e57a25ab6845829454e8d69fc972939a--> The following sections might be updated with supplementary metadata relevant to reviewers and maintainers. <!--006a51241073e994b41acfe9ec718e94--> ### External sites * Code coverage & benchmarks: https://corecheck.dev/bitcoin/bitcoin/pulls/36152 * Ralph review <img src=https://review.fish.foo/assets/bitcoin/bitcoin/36152.png alt="Ralph review status"> https://git.fish.foo/bitcoin/bitcoin/pulls/36152#author-ralph <!--021abf342d371248e50ceaed478a90ca--> ### Reviews See [the guideline](https://github.com/bitcoin/bitcoin/blob/master/CONTRIBUTING.md#code-review) and [AI policy](https://github.com/bitcoin/bitcoin/blob/master/doc/AI_POLICY.md) for information on the review process. | Type | Reviewers | | ---- | --------- | | ACK | [Marisha-Sahay](https://github.com/bitcoin/bitcoin/pull/36152#issuecomment-5648864879), [naiyoma](https://github.com/bitcoin/bitcoin/pull/36152#pullrequestreview-5395675874), [sedited](https://github.com/bitcoin/bitcoin/pull/36152#pullrequestreview-5425472790) | If your review is incorrectly listed, please copy-paste <code>&lt;!--meta-tag:bot-skip--&gt;</code> into the comment that the bot should ignore. <!--5faf32d7da4f0f540f40219e4f7537a3-->
naiyoma (Migrated from github.com) reviewed 2026-09-07 14:43:31 +00:00
naiyoma (Migrated from github.com) left a comment
Concept ACK, ( not sure if this is out of scope). I think it would be great to kill https://bitcoincore.space/src/net_processing.cpp#3466 in this PR as well. I did this in https://github.com/naiyoma/bitcoin/pull/22/changes/b7bdb41050cb20c80a72a9584fd52b4a6d45cdda
brunoerg commented 2026-09-08 20:36:33 +00:00 (Migrated from github.com)

Concept ACK, ( not sure if this is out of scope). I think it would be great to kill https://bitcoincore.space/src/net_processing.cpp#3466 in this PR as well.

I did this in naiyoma@b7bdb41

Not out of scope, it's a simple test case and related so I just pushed adding it here as well. Thank you.

> Concept ACK, ( not sure if this is out of scope). I think it would be great to kill https://bitcoincore.space/src/net_processing.cpp#3466 in this PR as well. > > I did this in [naiyoma@b7bdb41](https://github.com/naiyoma/bitcoin/commit/b7bdb41050cb20c80a72a9584fd52b4a6d45cdda) Not out of scope, it's a simple test case and related so I just pushed adding it here as well. Thank you.
Marisha-Sahay commented 2026-09-12 21:38:49 +00:00 (Migrated from github.com)

tACK 2fabbc0bb3

Compiled and ran test/functional/p2p_leak.py on macOS. Everything passes.

tACK 2fabbc0bb38d0b87913d16777e25497ee6d017f0 Compiled and ran test/functional/p2p_leak.py on macOS. Everything passes.
naiyoma (Migrated from github.com) reviewed 2026-10-02 19:01:39 +00:00
naiyoma (Migrated from github.com) left a comment

tACK 2fabbc0bb3

generated and analyzed mutants locally, all 3 killed

tACK 2fabbc0bb38d0b87913d16777e25497ee6d017f0 generated and analyzed mutants locally, all 3 killed
First-time contributor

Base: 65896ac58ea63e29ad19d41b492e37f8722ac715
Head: 2fabbc0bb38d0b87913d16777e25497ee6d017f0

No verified findings are available from this partial review.

Review coverage was incomplete. The archaeology review had incomplete evidence. The adversarial_glm review did not complete.

Full review report

<!-- forgejo-review-bot:bitcoin/bitcoin --> Base: `65896ac58ea63e29ad19d41b492e37f8722ac715` Head: `2fabbc0bb38d0b87913d16777e25497ee6d017f0` No verified findings are available from this partial review. Review coverage was incomplete. The archaeology review had incomplete evidence. The adversarial_glm review did not complete. [Full review report](<https://review.fish.foo/traces/36152-2fabbc0bb38d0b87913d16777e25497ee6d017f0-311-1.html>)
sedited (Migrated from github.com) approved these changes 2026-10-06 08:02:14 +00:00
sedited (Migrated from github.com) left a comment
ACK 2fabbc0bb38d0b87913d16777e25497ee6d017f0
Sign in to join this conversation.
No reviewers
No milestone
No project
No assignees
2 participants
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set

Reference
bitcoin/bitcoin!36152
No description provided.