Skip to content

Commit b29dd41

Browse files
committed
[tests] add test for submit block
1 parent 9bf0d80 commit b29dd41

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

test/functional/getblocktemplate_proposals.py

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -53,12 +53,17 @@ def run_test(self):
5353
self.log.info("getblocktemplate: Test valid block")
5454
assert_template(node, block, None)
5555

56+
self.log.info("submitblock: Test block decode failure")
57+
assert_raises_jsonrpc(-22, "Block decode failed", node.submitblock, b2x(block.serialize()[:-15]))
58+
5659
self.log.info("getblocktemplate: Test bad input hash for coinbase transaction")
5760
bad_block = copy.deepcopy(block)
5861
bad_block.vtx[0].vin[0].prevout.hash += 1
5962
bad_block.vtx[0].rehash()
6063
assert_template(node, bad_block, 'bad-cb-missing')
6164

65+
self.log.info("submitblock: Test invalid coinbase transaction")
66+
assert_raises_jsonrpc(-22, "Block does not start with a coinbase", node.submitblock, b2x(bad_block.serialize()))
6267

6368
self.log.info("getblocktemplate: Test truncated final transaction")
6469
assert_raises_jsonrpc(-22, "Block decode failed", node.getblocktemplate, {'data': b2x(block.serialize()[:-1]), 'mode': 'proposal'})

0 commit comments

Comments
 (0)