Skip to content

Commit b22408d

Browse files
committed
Merge bitcoin/bitcoin#27603: test: added coverage to mining_basic.py
a7b46a1 test: added coverage to mining_basic.py (kevkevin) Pull request description: Included a test that checks if we call submitblock with block.vtx.empty() then it throws an rpc deserialization error, currently we only test if !block.vtx->IsCoinBase() throws an rpc deserialization error I've tested to make sure this actually doing what I intended by breaking up this if block into two if blocks with different error messages and running the functional test https://github.com/bitcoin/bitcoin/blob/322ec63b01499c1ec52d3912ee382ebd59f2366b/src/rpc/mining.cpp#L963 This change should increase the test coverage for the `submitblock()` rpc in `./src/rpc/mining.cpp` ACKs for top commit: theStack: ACK a7b46a1 Tree-SHA512: 4078cb1fa879cc9e34438319f73085b521b90a5a95348b23e494cf8e5ac792ec426bc0e1a63e949645e16afebe54c5f35a194f02e20b7273871163d89a5c44e6
2 parents 6a560ac + a7b46a1 commit b22408d

File tree

1 file changed

+1
-0
lines changed

1 file changed

+1
-0
lines changed

test/functional/mining_basic.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -145,6 +145,7 @@ def assert_submitblock(block, result_str_1, result_str_2=None):
145145
assert_template(node, bad_block, 'bad-cb-missing')
146146

147147
self.log.info("submitblock: Test invalid coinbase transaction")
148+
assert_raises_rpc_error(-22, "Block does not start with a coinbase", node.submitblock, CBlock().serialize().hex())
148149
assert_raises_rpc_error(-22, "Block does not start with a coinbase", node.submitblock, bad_block.serialize().hex())
149150

150151
self.log.info("getblocktemplate: Test truncated final transaction")

0 commit comments

Comments
 (0)