Expands the ipc mining test a bit with submitting a solved block and checking its validity.
test: Add submitblock test in interface_ipc #33380
pull TheCharlatan wants to merge 1 commits into bitcoin:master from TheCharlatan:interface_ipc_submitblock changing 1 files +42 −1-
TheCharlatan commented at 5:59 PM on September 12, 2025: contributor
- DrahtBot added the label Tests on Sep 12, 2025
-
DrahtBot commented at 5:59 PM on September 12, 2025: contributor
<!--e57a25ab6845829454e8d69fc972939a-->
The following sections might be updated with supplementary metadata relevant to reviewers and maintainers.
<!--006a51241073e994b41acfe9ec718e94-->
Code Coverage & Benchmarks
For details see: https://corecheck.dev/bitcoin/bitcoin/pulls/33380.
<!--021abf342d371248e50ceaed478a90ca-->
Reviews
See the guideline for information on the review process.
Type Reviewers ACK Sjors, marcofleon, zaidmstrr Stale ACK sipa If your review is incorrectly listed, please react with 👎 to this comment and the bot will ignore it on the next update.
<!--5faf32d7da4f0f540f40219e4f7537a3-->
-
sipa commented at 7:02 PM on September 12, 2025: member
utACK 557644ee9499583b6d00efda289fb65e8359e084
-
Sjors commented at 8:27 AM on September 15, 2025: member
ACK 557644ee9499583b6d00efda289fb65e8359e084
Could expand it a bit:
diff --git a/test/functional/interface_ipc.py b/test/functional/interface_ipc.py index 1651b53bda..89c1fd7d31 100755 --- a/test/functional/interface_ipc.py +++ b/test/functional/interface_ipc.py @@ -186,20 +186,33 @@ class IPCInterfaceTest(BitcoinTestFramework): balance = miniwallet.get_balance() coinbase.vout[0].scriptPubKey = miniwallet.get_output_script() coinbase.vout[0].nValue = COIN block.vtx[0] = coinbase block.hashMerkleRoot = block.calc_merkle_root() + + # Ensure the block is invalid by setting version to 0 + original_version = block.nVersion + block.nVersion = 0 + block.solve() + res = await mining.result.checkBlock(block.serialize(), check_opts) + assert_equal(res.result, False) + assert_equal(res.reason, "bad-version(0x00000000)") + res = await template.result.submitSolution(ctx, block.nVersion, block.nTime, block.nNonce, coinbase.serialize()) + assert_equal(res.result, False) + + block.nVersion = original_version block.solve() res = await mining.result.checkBlock(block.serialize(), check_opts) assert_equal(res.result, True) res = await template.result.submitSolution(ctx, block.nVersion, block.nTime, block.nNonce, coinbase.serialize()) assert_equal(res.result, True) assert_equal(self.nodes[0].getchaintips()[0]["height"], current_block_height + 1) miniwallet.rescan_utxos() assert_equal(miniwallet.get_balance(), balance + 1) res = await mining.result.checkBlock(block.serialize(), check_opts) assert_equal(res.result, False) + assert_equal(res.reason, "inconclusive-not-best-prevblk") self.log.debug("Destroy template objects") template.result.destroy(ctx) -
0a26731c4c
test: Add submitblock test in interface_ipc
Co-Authored-By: Sjors Provoost <sjors@sprovoost.nl>
- TheCharlatan force-pushed on Sep 15, 2025
-
TheCharlatan commented at 1:33 PM on September 15, 2025: contributor
Updated 557644ee9499583b6d00efda289fb65e8359e084 -> 0a26731c4cc182e887ce959cdd301227cdc752d7 (interface_ipc_submitblock_0 -> interface_ipc_submitblock_1, compare)
- Added @Sjors's suggested patch.
-
Sjors commented at 4:10 PM on September 15, 2025: member
ACK 0a26731c4cc182e887ce959cdd301227cdc752d7
- DrahtBot requested review from sipa on Sep 15, 2025
-
marcofleon commented at 10:58 AM on September 16, 2025: contributor
code review ACK 0a26731c4cc182e887ce959cdd301227cdc752d7
- fanquake requested review from ryanofsky on Sep 16, 2025
- glozow merged this on Sep 16, 2025
- glozow closed this on Sep 16, 2025