From 6c872d5e656a7117bbdf19a0220572b93de16f31 Mon Sep 17 00:00:00 2001 From: Andrew Chow Date: Wed, 7 Dec 2022 00:03:26 -0500 Subject: 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. --- test/functional/feature_taproot.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'test') diff --git a/test/functional/feature_taproot.py b/test/functional/feature_taproot.py index dbe51f8f54..f6f6f3f78b 100755 --- a/test/functional/feature_taproot.py +++ b/test/functional/feature_taproot.py @@ -1292,7 +1292,7 @@ class TaprootTest(BitcoinTestFramework): # It is not impossible to fit enough tapscript sigops to hit the old 80k limit without # busting txin-level limits. We simply have to account for the p2pk outputs in all # transactions. - extra_output_script = CScript([OP_CHECKSIG]*((MAX_BLOCK_SIGOPS_WEIGHT - sigops_weight) // WITNESS_SCALE_FACTOR)) + extra_output_script = CScript(bytes([OP_CHECKSIG]*((MAX_BLOCK_SIGOPS_WEIGHT - sigops_weight) // WITNESS_SCALE_FACTOR))) coinbase_tx = create_coinbase(self.lastblockheight + 1, pubkey=cb_pubkey, extra_output_script=extra_output_script, fees=fees) block = create_block(self.tip, coinbase_tx, self.lastblocktime + 1, txlist=txs) -- cgit v1.2.3