aboutsummaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authorJohn Newbery <john@johnnewbery.com>2017-04-11 16:42:35 -0400
committerJohn Newbery <john@johnnewbery.com>2017-06-27 15:51:37 +0100
commitb29dd41f0f8482fb6dbaa4f9fa468ac66069f207 (patch)
tree12df4f089aeaa571be73c37b66f8e40126ddf03c /test
parent9bf0d80ab07ede52629960b2478beff55401a51b (diff)
[tests] add test for submit block
Diffstat (limited to 'test')
-rwxr-xr-xtest/functional/getblocktemplate_proposals.py5
1 files changed, 5 insertions, 0 deletions
diff --git a/test/functional/getblocktemplate_proposals.py b/test/functional/getblocktemplate_proposals.py
index 777b20212c..311d9197ac 100755
--- a/test/functional/getblocktemplate_proposals.py
+++ b/test/functional/getblocktemplate_proposals.py
@@ -53,12 +53,17 @@ class GetBlockTemplateProposalTest(BitcoinTestFramework):
self.log.info("getblocktemplate: Test valid block")
assert_template(node, block, None)
+ self.log.info("submitblock: Test block decode failure")
+ assert_raises_jsonrpc(-22, "Block decode failed", node.submitblock, b2x(block.serialize()[:-15]))
+
self.log.info("getblocktemplate: Test bad input hash for coinbase transaction")
bad_block = copy.deepcopy(block)
bad_block.vtx[0].vin[0].prevout.hash += 1
bad_block.vtx[0].rehash()
assert_template(node, bad_block, 'bad-cb-missing')
+ self.log.info("submitblock: Test invalid coinbase transaction")
+ assert_raises_jsonrpc(-22, "Block does not start with a coinbase", node.submitblock, b2x(bad_block.serialize()))
self.log.info("getblocktemplate: Test truncated final transaction")
assert_raises_jsonrpc(-22, "Block decode failed", node.getblocktemplate, {'data': b2x(block.serialize()[:-1]), 'mode': 'proposal'})