test: clarify submitBlock() mutates the template
What changed, and why it matters
This is a harmless test-only change. It adds a new test case to make sure developers know that a mining interface function called submitBlock() changes the block template even when the submitted block is rejected. There is no security fix or vulnerability here.
No action needed. This is a test-only documentation commit with no security relevance.
Security signals we found
No strong security signals were identified.
Evidence from the diff
The commit adds assertions in test/functional/interface_ipc.py documenting that submitBlock()/submitSolution() mutates the remote CBlock template in place, including on a rejected submission. It verifies the mutation by comparing serialized versions of the parsed template before and after a rejected call. This is purely a behavioral regression test; no production code is modified.
Changed components
test/functional/interface_ipc.pyInspect captured patch +9 / −0
diff --git a/test/functional/interface_ipc.py b/test/functional/interface_ipc.py
index e905c775..cce56e32 100755
--- a/test/functional/interface_ipc.py
+++ b/test/functional/interface_ipc.py
@@ -215,11 +215,20 @@ class IPCInterfaceTest(BitcoinTestFramework):
res = await mining.result.checkBlock(block.serialize(), check_opts)
assert_equal(res.result, True)
+ # The remote template block will be mutated, capture the original:
+ remote_block_before = await self.parse_and_deserialize_block(template, ctx)
+
self.log.debug("Submitted coinbase must include witness")
assert_not_equal(coinbase.serialize_without_witness().hex(), coinbase.serialize().hex())
res = await template.result.submitSolution(ctx, block.nVersion, block.nTime, block.nNonce, coinbase.serialize_without_witness())
assert_equal(res.result, False)
+ self.log.debug("Even a rejected submitBlock() mutates the template's block")
+ # Can be used by clients to download and inspect the (rejected)
+ # reconstructed block.
+ remote_block_after = await self.parse_and_deserialize_block(template, ctx)
+ assert_not_equal(remote_block_before.serialize().hex(), remote_block_after.serialize().hex())
+
self.log.debug("Submit again, with the witness")
res = await template.result.submitSolution(ctx, block.nVersion, block.nTime, block.nNonce, coinbase.serialize())
assert_equal(res.result, True)
Why this scored 15/100
Community notes
Notes can correct, qualify, or add evidence to the AI analysis. Every note shown here has been validated by a human moderator.
The AI analysis stands alone for now. Submit a note if you can add evidence or important context.