aboutsummaryrefslogtreecommitdiff
path: root/test/functional/mining_basic.py
diff options
context:
space:
mode:
Diffstat (limited to 'test/functional/mining_basic.py')
-rwxr-xr-xtest/functional/mining_basic.py12
1 files changed, 6 insertions, 6 deletions
diff --git a/test/functional/mining_basic.py b/test/functional/mining_basic.py
index 661d9f4c97..713c8beab8 100755
--- a/test/functional/mining_basic.py
+++ b/test/functional/mining_basic.py
@@ -15,6 +15,7 @@ from test_framework.blocktools import create_coinbase
from test_framework.messages import (
CBlock,
CBlockHeader,
+ BLOCK_HEADER_SIZE
)
from test_framework.mininode import (
P2PDataStore,
@@ -131,10 +132,9 @@ class MiningTest(BitcoinTestFramework):
self.log.info("getblocktemplate: Test bad tx count")
# The tx count is immediately after the block header
- TX_COUNT_OFFSET = 80
bad_block_sn = bytearray(block.serialize())
- assert_equal(bad_block_sn[TX_COUNT_OFFSET], 1)
- bad_block_sn[TX_COUNT_OFFSET] += 1
+ assert_equal(bad_block_sn[BLOCK_HEADER_SIZE], 1)
+ bad_block_sn[BLOCK_HEADER_SIZE] += 1
assert_raises_rpc_error(-22, "Block decode failed", node.getblocktemplate, {'data': b2x(bad_block_sn), 'mode': 'proposal', 'rules': ['segwit']})
self.log.info("getblocktemplate: Test bad bits")
@@ -164,9 +164,9 @@ class MiningTest(BitcoinTestFramework):
assert_submitblock(bad_block, 'prev-blk-not-found', 'prev-blk-not-found')
self.log.info('submitheader tests')
- assert_raises_rpc_error(-22, 'Block header decode failed', lambda: node.submitheader(hexdata='xx' * 80))
- assert_raises_rpc_error(-22, 'Block header decode failed', lambda: node.submitheader(hexdata='ff' * 78))
- assert_raises_rpc_error(-25, 'Must submit previous header', lambda: node.submitheader(hexdata='ff' * 80))
+ assert_raises_rpc_error(-22, 'Block header decode failed', lambda: node.submitheader(hexdata='xx' * BLOCK_HEADER_SIZE))
+ assert_raises_rpc_error(-22, 'Block header decode failed', lambda: node.submitheader(hexdata='ff' * (BLOCK_HEADER_SIZE-2)))
+ assert_raises_rpc_error(-25, 'Must submit previous header', lambda: node.submitheader(hexdata='ff' * BLOCK_HEADER_SIZE))
block.nTime += 1
block.solve()