aboutsummaryrefslogtreecommitdiff
path: root/qa/rpc-tests/pruning.py
diff options
context:
space:
mode:
authorMarcoFalke <falke.marco@gmail.com>2016-12-06 12:05:31 +0100
committerMarcoFalke <falke.marco@gmail.com>2016-12-06 12:08:27 +0100
commit919db037f1f5cc73cdcaef92dd9cb0e7f5c8dec3 (patch)
tree8a13af0f51314109b43e714b7e301dfb89189de5 /qa/rpc-tests/pruning.py
parented8d693c71b01caa310922f883b3915c09bb6a35 (diff)
parentfab1af31d43f0db58f590992d1cc5e302f1133f8 (diff)
Merge #9274: [qa] Use cached utxo set to fix performance regression
fab1af3 [qa] maxuploadtarget: Use cached utxo set (MarcoFalke) fa2ecc4 [qa] pruning: Use cached utxo set to run faster (MarcoFalke)
Diffstat (limited to 'qa/rpc-tests/pruning.py')
-rwxr-xr-xqa/rpc-tests/pruning.py15
1 files changed, 11 insertions, 4 deletions
diff --git a/qa/rpc-tests/pruning.py b/qa/rpc-tests/pruning.py
index 6635b0dff2..78b8938e4a 100755
--- a/qa/rpc-tests/pruning.py
+++ b/qa/rpc-tests/pruning.py
@@ -13,6 +13,9 @@
from test_framework.test_framework import BitcoinTestFramework
from test_framework.util import *
+import time
+import os
+
def calc_usage(blockdir):
return sum(os.path.getsize(blockdir+f) for f in os.listdir(blockdir) if os.path.isfile(blockdir+f)) / (1024. * 1024.)
@@ -24,6 +27,10 @@ class PruneTest(BitcoinTestFramework):
self.setup_clean_chain = True
self.num_nodes = 3
+ # Cache for utxos, as the listunspent may take a long time later in the test
+ self.utxo_cache_0 = []
+ self.utxo_cache_1 = []
+
def setup_network(self):
self.nodes = []
self.is_network_split = False
@@ -48,7 +55,7 @@ class PruneTest(BitcoinTestFramework):
self.nodes[0].generate(150)
# Then mine enough full blocks to create more than 550MiB of data
for i in range(645):
- mine_large_block(self.nodes[0])
+ mine_large_block(self.nodes[0], self.utxo_cache_0)
sync_blocks(self.nodes[0:3])
@@ -60,7 +67,7 @@ class PruneTest(BitcoinTestFramework):
print("Mining 25 more blocks should cause the first block file to be pruned")
# Pruning doesn't run until we're allocating another chunk, 20 full blocks past the height cutoff will ensure this
for i in range(25):
- mine_large_block(self.nodes[0])
+ mine_large_block(self.nodes[0], self.utxo_cache_0)
waitstart = time.time()
while os.path.isfile(self.prunedir+"blk00000.dat"):
@@ -87,13 +94,13 @@ class PruneTest(BitcoinTestFramework):
# Mine 24 blocks in node 1
for i in range(24):
if j == 0:
- mine_large_block(self.nodes[1])
+ mine_large_block(self.nodes[1], self.utxo_cache_1)
else:
self.nodes[1].generate(1) #tx's already in mempool from previous disconnects
# Reorg back with 25 block chain from node 0
for i in range(25):
- mine_large_block(self.nodes[0])
+ mine_large_block(self.nodes[0], self.utxo_cache_0)
# Create connections in the order so both nodes can see the reorg at the same time
connect_nodes(self.nodes[1], 0)