diff options
author | 721217.xyz <*~=`'#}+{/-|&$^_@721217.xyz> | 2023-02-09 12:33:11 +0100 |
---|---|---|
committer | 721217.xyz <*~=`'#}+{/-|&$^_@721217.xyz> | 2023-02-09 12:28:56 +0100 |
commit | fa6f67837b08a808cdd72856ac24cc932863daf4 (patch) | |
tree | bd146f4c2df37f2b55537a8b784fe98ab470e81a | |
parent | dc905f6c2a60961aee73578fd3092bf90b28409f (diff) |
test: Fix intermittent sync issue in wallet_pruning
-rwxr-xr-x | test/functional/wallet_pruning.py | 9 |
1 files changed, 5 insertions, 4 deletions
diff --git a/test/functional/wallet_pruning.py b/test/functional/wallet_pruning.py index 6d8475ce8d..504014f839 100755 --- a/test/functional/wallet_pruning.py +++ b/test/functional/wallet_pruning.py @@ -39,11 +39,15 @@ class WalletPruningTest(BitcoinTestFramework): def mine_large_blocks(self, node, n): # Get the block parameters for the first block - best_block = node.getblock(node.getbestblockhash()) + best_block = node.getblockheader(node.getbestblockhash()) height = int(best_block["height"]) + 1 self.nTime = max(self.nTime, int(best_block["time"])) + 1 previousblockhash = int(best_block["hash"], 16) big_script = CScript([OP_RETURN] + [OP_TRUE] * 950000) + # Set mocktime to accept all future blocks + for i in self.nodes: + if i.running: + i.setmocktime(self.nTime + 600 * n) for _ in range(n): block = create_block(hashprev=previousblockhash, ntime=self.nTime, coinbase=create_coinbase(height, script_pubkey=big_script)) block.solve() @@ -57,9 +61,6 @@ class WalletPruningTest(BitcoinTestFramework): # Simulate 10 minutes of work time per block # Important for matching a timestamp with a block +- some window self.nTime += 600 - for n in self.nodes: - if n.running: - n.setmocktime(self.nTime) # Update node's time to accept future blocks self.sync_all() def test_wallet_import_pruned(self, wallet_name): |