diff options
Diffstat (limited to 'test/functional/feature_pruning.py')
-rwxr-xr-x | test/functional/feature_pruning.py | 25 |
1 files changed, 7 insertions, 18 deletions
diff --git a/test/functional/feature_pruning.py b/test/functional/feature_pruning.py index 58bc6ca67c..de1ea8a3a6 100755 --- a/test/functional/feature_pruning.py +++ b/test/functional/feature_pruning.py @@ -10,8 +10,11 @@ This test takes 30 mins or more (up to 2 hours) """ import os -from test_framework.blocktools import create_coinbase -from test_framework.messages import CBlock +from test_framework.blocktools import ( + MIN_BLOCKS_TO_KEEP, + create_block, + create_coinbase, +) from test_framework.script import ( CScript, OP_NOP, @@ -48,21 +51,7 @@ def mine_large_blocks(node, n): previousblockhash = int(best_block["hash"], 16) for _ in range(n): - # Build the coinbase transaction (with large scriptPubKey) - coinbase_tx = create_coinbase(height) - coinbase_tx.vin[0].nSequence = 2 ** 32 - 1 - coinbase_tx.vout[0].scriptPubKey = big_script - coinbase_tx.rehash() - - # Build the block - block = CBlock() - block.nVersion = best_block["version"] - block.hashPrevBlock = previousblockhash - block.nTime = mine_large_blocks.nTime - block.nBits = int('207fffff', 16) - block.nNonce = 0 - block.vtx = [coinbase_tx] - block.hashMerkleRoot = block.calc_merkle_root() + block = create_block(hashprev=previousblockhash, ntime=mine_large_blocks.nTime, coinbase=create_coinbase(height, script_pubkey=big_script)) block.solve() # Submit to the node @@ -345,7 +334,7 @@ class PruneTest(BitcoinTestFramework): assert has_block(2), "blk00002.dat is still there, should be pruned by now" # advance the tip so blk00002.dat and blk00003.dat can be pruned (the last 288 blocks should now be in blk00004.dat) - self.generate(node, 288, sync_fun=self.no_op) + self.generate(node, MIN_BLOCKS_TO_KEEP, sync_fun=self.no_op) prune(1000) assert not has_block(2), "blk00002.dat is still there, should be pruned by now" assert not has_block(3), "blk00003.dat is still there, should be pruned by now" |