7
7
# Test pruning code
8
8
# ********
9
9
# WARNING:
10
- # This test uses 4GB of disk space and takes in excess of 30 mins to run
10
+ # This test uses 4GB of disk space.
11
+ # This test takes 30 mins or more (up to 2 hours)
11
12
# ********
12
13
13
14
from test_framework import BitcoinTestFramework
@@ -51,11 +52,11 @@ def setup_network(self):
51
52
self .is_network_split = False
52
53
53
54
# Create nodes 0 and 1 to mine
54
- self .nodes .append (start_node (0 , self .options .tmpdir , ["-debug" ,"-maxreceivebuffer=20000" ,"-blockmaxsize=999000" , "-checkblocks=5" ], timewait = 300 ))
55
- self .nodes .append (start_node (1 , self .options .tmpdir , ["-debug" ,"-maxreceivebuffer=20000" ,"-blockmaxsize=999000" , "-checkblocks=5" ], timewait = 300 ))
55
+ self .nodes .append (start_node (0 , self .options .tmpdir , ["-debug" ,"-maxreceivebuffer=20000" ,"-blockmaxsize=999000" , "-checkblocks=5" ], timewait = 900 ))
56
+ self .nodes .append (start_node (1 , self .options .tmpdir , ["-debug" ,"-maxreceivebuffer=20000" ,"-blockmaxsize=999000" , "-checkblocks=5" ], timewait = 900 ))
56
57
57
58
# Create node 2 to test pruning
58
- self .nodes .append (start_node (2 , self .options .tmpdir , ["-debug" ,"-maxreceivebuffer=20000" ,"-prune=550" ], timewait = 300 ))
59
+ self .nodes .append (start_node (2 , self .options .tmpdir , ["-debug" ,"-maxreceivebuffer=20000" ,"-prune=550" ], timewait = 900 ))
59
60
self .prunedir = self .options .tmpdir + "/node2/regtest/blocks/"
60
61
61
62
self .address [0 ] = self .nodes [0 ].getnewaddress ()
@@ -108,7 +109,7 @@ def create_chain_with_staleblocks(self):
108
109
# Node 2 stays connected, so it hears about the stale blocks and then reorg's when node0 reconnects
109
110
# Stopping node 0 also clears its mempool, so it doesn't have node1's transactions to accidentally mine
110
111
stop_node (self .nodes [0 ],0 )
111
- self .nodes [0 ]= start_node (0 , self .options .tmpdir , ["-debug" ,"-maxreceivebuffer=20000" ,"-blockmaxsize=999000" , "-checkblocks=5" ], timewait = 300 )
112
+ self .nodes [0 ]= start_node (0 , self .options .tmpdir , ["-debug" ,"-maxreceivebuffer=20000" ,"-blockmaxsize=999000" , "-checkblocks=5" ], timewait = 900 )
112
113
# Mine 24 blocks in node 1
113
114
self .utxo = self .nodes [1 ].listunspent ()
114
115
for i in xrange (24 ):
@@ -135,7 +136,7 @@ def reorg_test(self):
135
136
# Reboot node 1 to clear its mempool (hopefully make the invalidate faster)
136
137
# Lower the block max size so we don't keep mining all our big mempool transactions (from disconnected blocks)
137
138
stop_node (self .nodes [1 ],1 )
138
- self .nodes [1 ]= start_node (1 , self .options .tmpdir , ["-debug" ,"-maxreceivebuffer=20000" ,"-blockmaxsize=5000" , "-checkblocks=5" , "-disablesafemode" ], timewait = 300 )
139
+ self .nodes [1 ]= start_node (1 , self .options .tmpdir , ["-debug" ,"-maxreceivebuffer=20000" ,"-blockmaxsize=5000" , "-checkblocks=5" , "-disablesafemode" ], timewait = 900 )
139
140
140
141
height = self .nodes [1 ].getblockcount ()
141
142
print "Current block height:" , height
@@ -158,7 +159,7 @@ def reorg_test(self):
158
159
159
160
# Reboot node1 to clear those giant tx's from mempool
160
161
stop_node (self .nodes [1 ],1 )
161
- self .nodes [1 ]= start_node (1 , self .options .tmpdir , ["-debug" ,"-maxreceivebuffer=20000" ,"-blockmaxsize=5000" , "-checkblocks=5" , "-disablesafemode" ], timewait = 300 )
162
+ self .nodes [1 ]= start_node (1 , self .options .tmpdir , ["-debug" ,"-maxreceivebuffer=20000" ,"-blockmaxsize=5000" , "-checkblocks=5" , "-disablesafemode" ], timewait = 900 )
162
163
163
164
print "Generating new longer chain of 300 more blocks"
164
165
self .nodes [1 ].generate (300 )
@@ -223,7 +224,7 @@ def reorg_back(self):
223
224
waitstart = time .time ()
224
225
while self .nodes [2 ].getblockcount () < goalbestheight :
225
226
time .sleep (0.1 )
226
- if time .time () - waitstart > 300 :
227
+ if time .time () - waitstart > 900 :
227
228
raise AssertionError ("Node 2 didn't reorg to proper height" )
228
229
assert (self .nodes [2 ].getbestblockhash () == goalbesthash )
229
230
# Verify we can now have the data for a block previously pruned
@@ -256,7 +257,7 @@ def mine_full_block(self, node, address):
256
257
257
258
258
259
def run_test (self ):
259
- print "Warning! This test requires 4GB of disk space and takes over 30 mins"
260
+ print "Warning! This test requires 4GB of disk space and takes over 30 mins (up to 2 hours) "
260
261
print "Mining a big blockchain of 995 blocks"
261
262
self .create_big_chain ()
262
263
# Chain diagram key:
0 commit comments