Skip to content

Commit 6c872d5

Browse files
committed
tests: Initialize sigops draining script with bytes in feature_taproot
The sigops draining script in feature_taproot's block_submit was initialized with a list that would end up always being iterated by CScript's constructor. Since this list is very large, a lot of time would be wasted. By creating and passing a bytes object initialized from that list, we can avoid this iteration and dramatically improve the runtime of feature_taproot.
1 parent 544cbf7 commit 6c872d5

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

test/functional/feature_taproot.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1292,7 +1292,7 @@ def block_submit(self, node, txs, msg, err_msg, cb_pubkey=None, fees=0, sigops_w
12921292
# It is not impossible to fit enough tapscript sigops to hit the old 80k limit without
12931293
# busting txin-level limits. We simply have to account for the p2pk outputs in all
12941294
# transactions.
1295-
extra_output_script = CScript([OP_CHECKSIG]*((MAX_BLOCK_SIGOPS_WEIGHT - sigops_weight) // WITNESS_SCALE_FACTOR))
1295+
extra_output_script = CScript(bytes([OP_CHECKSIG]*((MAX_BLOCK_SIGOPS_WEIGHT - sigops_weight) // WITNESS_SCALE_FACTOR)))
12961296

12971297
coinbase_tx = create_coinbase(self.lastblockheight + 1, pubkey=cb_pubkey, extra_output_script=extra_output_script, fees=fees)
12981298
block = create_block(self.tip, coinbase_tx, self.lastblocktime + 1, txlist=txs)

0 commit comments

Comments
 (0)