mirror of
https://github.com/bitcoin/bitcoin.git
synced 2025-02-22 23:07:59 +01:00
test: refactor: simplify block_submit
in feature_nulldummy.py
The `create_block` helper accepts a list of txs that it includes in the created block, hence we don't have to do that manually. Also, rehashing before solving the block is not needed and can be removed.
This commit is contained in:
parent
5ba9f1ff59
commit
f1ed30451f
1 changed files with 1 additions and 6 deletions
|
@ -121,14 +121,9 @@ class NULLDUMMYTest(BitcoinTestFramework):
|
|||
tmpl = node.getblocktemplate(NORMAL_GBT_REQUEST_PARAMS)
|
||||
assert_equal(tmpl['previousblockhash'], self.lastblockhash)
|
||||
assert_equal(tmpl['height'], self.lastblockheight + 1)
|
||||
block = create_block(tmpl=tmpl, ntime=self.lastblocktime + 1)
|
||||
for tx in txs:
|
||||
tx.rehash()
|
||||
block.vtx.append(tx)
|
||||
block.hashMerkleRoot = block.calc_merkle_root()
|
||||
block = create_block(tmpl=tmpl, ntime=self.lastblocktime + 1, txlist=txs)
|
||||
if with_witness:
|
||||
add_witness_commitment(block)
|
||||
block.rehash()
|
||||
block.solve()
|
||||
assert_equal(None if accept else NULLDUMMY_ERROR, node.submitblock(block.serialize().hex()))
|
||||
if accept:
|
||||
|
|
Loading…
Add table
Reference in a new issue