Skip to content

Commit f1ed304

Browse files
committed
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.
1 parent 5ba9f1f commit f1ed304

File tree

1 file changed

+1
-6
lines changed

1 file changed

+1
-6
lines changed

test/functional/feature_nulldummy.py

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -121,14 +121,9 @@ def block_submit(self, node, txs, *, with_witness=False, accept):
121121
tmpl = node.getblocktemplate(NORMAL_GBT_REQUEST_PARAMS)
122122
assert_equal(tmpl['previousblockhash'], self.lastblockhash)
123123
assert_equal(tmpl['height'], self.lastblockheight + 1)
124-
block = create_block(tmpl=tmpl, ntime=self.lastblocktime + 1)
125-
for tx in txs:
126-
tx.rehash()
127-
block.vtx.append(tx)
128-
block.hashMerkleRoot = block.calc_merkle_root()
124+
block = create_block(tmpl=tmpl, ntime=self.lastblocktime + 1, txlist=txs)
129125
if with_witness:
130126
add_witness_commitment(block)
131-
block.rehash()
132127
block.solve()
133128
assert_equal(None if accept else NULLDUMMY_ERROR, node.submitblock(block.serialize().hex()))
134129
if accept:

0 commit comments

Comments
 (0)