mirror of
https://github.com/ElementsProject/elements.git
synced 2026-08-15 12:51:00 +02:00
MERGE-FIX: mining_basic.py: Remove magic constants, make sure serialized header deserializes
This commit is contained in:
parent
c5a93c008f
commit
60b7ef5287
1 changed files with 6 additions and 4 deletions
|
|
@ -108,7 +108,7 @@ class MiningTest(BitcoinTestFramework):
|
|||
|
||||
self.log.info("getblocktemplate: Test bad tx count")
|
||||
# The tx count is immediately after the block header
|
||||
TX_COUNT_OFFSET = 80+4 # height is extra 4
|
||||
TX_COUNT_OFFSET = len(CBlockHeader().serialize())
|
||||
bad_block_sn = bytearray(block.serialize())
|
||||
assert_equal(bad_block_sn[TX_COUNT_OFFSET], 1)
|
||||
bad_block_sn[TX_COUNT_OFFSET] += 1
|
||||
|
|
@ -138,9 +138,11 @@ class MiningTest(BitcoinTestFramework):
|
|||
assert_template(node, bad_block, 'inconclusive-not-best-prevblk')
|
||||
|
||||
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' * TX_COUNT_OFFSET))
|
||||
assert_raises_rpc_error(-22, 'Block header decode failed', lambda: node.submitheader(hexdata='ff' * (TX_COUNT_OFFSET-2)))
|
||||
import pdb
|
||||
pdb.set_trace()
|
||||
assert_raises_rpc_error(-25, 'Must submit previous header', lambda: node.submitheader(hexdata=super(CBlock, bad_block).serialize().hex()))
|
||||
|
||||
block.solve()
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue