refactor: deduplicate block validation state catcher #36469

Manually merged
enirox001 merged 1 commit from 08_10_deduplicate_submit into master 2026-10-14 08:07:56 +00:00 AGit
enirox001 commented 2026-10-08 10:44:42 +00:00 (Migrated from github.com)

As mentioned in https://github.com/bitcoin/bitcoin/pull/34644#discussion_r2889315162 and https://github.com/bitcoin/bitcoin/pull/35675#discussion_r360301816, the validation state catchers were defined in the block template manager, submitblock rpc and mining test helpers, even though they do the same thing.

Moved this helper into node/block_validation_state_catcher.h and reuse it across all three callers. An optional validation state replaces the separate found flag where used, preserving each caller's registration and result handling

Replaces #36389 with the same commit on a dedicated branch.

As mentioned in https://github.com/bitcoin/bitcoin/pull/34644#discussion_r2889315162 and https://github.com/bitcoin/bitcoin/pull/35675#discussion_r360301816, the validation state catchers were defined in the block template manager, `submitblock` rpc and mining test helpers, even though they do the same thing. Moved this helper into `node/block_validation_state_catcher.h` and reuse it across all three callers. An optional validation state replaces the separate `found` flag where used, preserving each caller's registration and result handling Replaces #36389 with the same commit on a dedicated branch.
DrahtBot commented 2026-10-08 10:44:50 +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 ismaelsadeeq, maflcko, sedited, w0xlt
Concept ACK Grace-Ujah

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:

  • #36356 (mining: move getblocktemplate cache into BlockTemplateManager by w0xlt)
  • #35671 (mining: add TxCollection to bandwidth-efficiently validate external block templates by Sjors)
  • #35300 (mining: add precious option to IPC block submission by w0xlt)
  • #33922 (mining: add getMemoryLoad() and track template non-mempool memory footprint by Sjors)

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.

LLM Linter (✨ experimental)

Possible places where named args for integral literals may be used (e.g. func(x, /*named_arg=*/0) in C++, and func(x, named_arg=0) in Python):

  • src/test/util/mining.cpp: ProcessNewBlock(block, true, true, &new_block)

2026-10-08 15:06:00

<!--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/36469 * Ralph review <img src=https://review.fish.foo/assets/bitcoin/bitcoin/36469.png alt="Ralph review status"> https://git.fish.foo/bitcoin/bitcoin/pulls/36469#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 | [ismaelsadeeq](https://github.com/bitcoin/bitcoin/pull/36469#pullrequestreview-5465543502), [maflcko](https://github.com/bitcoin/bitcoin/pull/36469#issuecomment-6142563063), [sedited](https://github.com/bitcoin/bitcoin/pull/36469#pullrequestreview-5514674775), [w0xlt](https://github.com/bitcoin/bitcoin/pull/36469#pullrequestreview-5514709387) | | Concept ACK | [Grace-Ujah](https://github.com/bitcoin/bitcoin/pull/36469#pullrequestreview-5457367649) | 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. <!--174a7506f384e20aa4161008e828411d--> ### Conflicts Reviewers, this pull request conflicts with the following ones: * [#36356](https://github.com/bitcoin/bitcoin/pull/36356) <sub><img src="https://drahtbot.space/ack_count/bitcoin/bitcoin/36356.svg"></sub> (mining: move getblocktemplate cache into BlockTemplateManager by w0xlt) * [#35671](https://github.com/bitcoin/bitcoin/pull/35671) <sub><img src="https://drahtbot.space/ack_count/bitcoin/bitcoin/35671.svg"></sub> (mining: add TxCollection to bandwidth-efficiently validate external block templates by Sjors) * [#35300](https://github.com/bitcoin/bitcoin/pull/35300) <sub><img src="https://drahtbot.space/ack_count/bitcoin/bitcoin/35300.svg"></sub> (mining: add precious option to IPC block submission by w0xlt) * [#33922](https://github.com/bitcoin/bitcoin/pull/33922) <sub><img src="https://drahtbot.space/ack_count/bitcoin/bitcoin/33922.svg"></sub> (mining: add getMemoryLoad() and track template non-mempool memory footprint by Sjors) 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. <!--5faf32d7da4f0f540f40219e4f7537a3--> ### LLM Linter (✨ experimental) Possible places where named args for integral literals may be used (e.g. `func(x, /*named_arg=*/0)` in C++, and `func(x, named_arg=0)` in Python): - `src/test/util/mining.cpp`: `ProcessNewBlock(block, true, true, &new_block)` <sup>2026-10-08 15:06:00</sup>
sedited commented 2026-10-08 10:48:15 +00:00 (Migrated from github.com)

Concept ACK

Concept ACK
First-time contributor

Base: 8ad7e25d1fffb086692c0e17ed168838dde6e66f
Head: c9cccf6d68c682e533876b4450f5ad7044a79f10

Findings

Major

The node parameter shadows the namespace (src/test/util/mining.cpp:144, head)

In ProcessBlock, the parameter named node makes node::BlockValidationStateCatcher resolve to the local parameter rather than the namespace, causing compilation to fail for targets that build this test utility. Qualify the namespace as ::node::BlockValidationStateCatcher or rename the parameter.

Review coverage was incomplete. adversarial_glm: Initial repository exploration complete: located the new header and all three modified files.

Full review report

<!-- forgejo-review-bot:bitcoin/bitcoin --> Base: `8ad7e25d1fffb086692c0e17ed168838dde6e66f` Head: `c9cccf6d68c682e533876b4450f5ad7044a79f10` ##### Findings **Major** **The `node` parameter shadows the namespace** (src/test/util/mining.cpp:144, head) In `ProcessBlock`, the parameter named `node` makes `node::BlockValidationStateCatcher` resolve to the local parameter rather than the namespace, causing compilation to fail for targets that build this test utility. Qualify the namespace as `::node::BlockValidationStateCatcher` or rename the parameter. Review coverage was incomplete. adversarial_glm: Initial repository exploration complete: located the new header and all three modified files. [Full review report](<https://review.fish.foo/traces/36469-c9cccf6d68c682e533876b4450f5ad7044a79f10-594-4.html>)
Grace-Ujah (Migrated from github.com) reviewed 2026-10-08 13:31:08 +00:00
Grace-Ujah (Migrated from github.com) left a comment

Concept ACK 5852e3d35a

Concept ACK 5852e3d35a42749d267f2783269a9568bf67e53d
w0xlt commented 2026-10-08 15:26:22 +00:00 (Migrated from github.com)

Concept ACK

Concept ACK
ismaelsadeeq (Migrated from github.com) approved these changes 2026-10-09 03:55:29 +00:00
ismaelsadeeq (Migrated from github.com) left a comment

ACK c9cccf6d68

dedup is clean.

ACK c9cccf6d68c682e533876b4450f5ad7044a79f10 dedup is clean.
maflcko commented 2026-10-13 09:30:27 +00:00 (Migrated from github.com)

review ACK c9cccf6d68 🖋

Show signature

Signature:

untrusted comment: signature from minisign secret key on empty file; verify via: minisign -Vm "${path_to_any_empty_file}" -P RWTRmVTMeKV5noAMqVlsMugDDCyyTSbA3Re5AkUrhvLVln0tSaFWglOw -x "${path_to_this_whole_four_line_signature_blob}"
RUTRmVTMeKV5npGrKx1nqXCw5zeVHdtdYURB/KlyA/LMFgpNCs+SkW9a8N95d+U4AP1RJMi+krxU1A3Yux4bpwZNLvVBKy0wLgM=
trusted comment: review ACK c9cccf6d68c682e533876b4450f5ad7044a79f1 🖋
YXg33xQFEsbGv20Co4NpeVSPnWpOcqgCqsMdHbG2gR8/X8uOlrpulBHHty/HdgRpeaOXwWwxp3O2G+hpd7ZxAw==
review ACK c9cccf6d68c682e533876b4450f5ad7044a79f1 🖋 <details><summary>Show signature</summary> Signature: ``` untrusted comment: signature from minisign secret key on empty file; verify via: minisign -Vm "${path_to_any_empty_file}" -P RWTRmVTMeKV5noAMqVlsMugDDCyyTSbA3Re5AkUrhvLVln0tSaFWglOw -x "${path_to_this_whole_four_line_signature_blob}" RUTRmVTMeKV5npGrKx1nqXCw5zeVHdtdYURB/KlyA/LMFgpNCs+SkW9a8N95d+U4AP1RJMi+krxU1A3Yux4bpwZNLvVBKy0wLgM= trusted comment: review ACK c9cccf6d68c682e533876b4450f5ad7044a79f1 🖋 YXg33xQFEsbGv20Co4NpeVSPnWpOcqgCqsMdHbG2gR8/X8uOlrpulBHHty/HdgRpeaOXwWwxp3O2G+hpd7ZxAw== ``` </details>
sedited (Migrated from github.com) approved these changes 2026-10-14 07:48:08 +00:00
sedited (Migrated from github.com) left a comment
ACK c9cccf6d68c682e533876b4450f5ad7044a79f10
w0xlt (Migrated from github.com) reviewed 2026-10-14 07:51:26 +00:00
w0xlt (Migrated from github.com) left a comment
ACK c9cccf6d68c682e533876b4450f5ad7044a79f10
Sign in to join this conversation.
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!36469
No description provided.