3333# compatible with pruning based on key creation time.
3434TIMESTAMP_WINDOW = 2 * 60 * 60
3535
36+ DEPLOYMENT_ARGS = [
37+ "-dip3params=2000:2000" ,
38+ "-testactivationheight=dip0001@2000" ,
39+ "-testactivationheight=dip0008@2000" ,
40+ "-testactivationheight=v20@2000" ,
41+ ]
42+
3643def mine_large_blocks (node , n ):
3744 # Make a large scriptPubKey for the coinbase transaction. This is OP_RETURN
3845 # followed by 950k of OP_NOP. This would be non-standard in a non-coinbase
@@ -87,16 +94,16 @@ def set_test_params(self):
8794
8895 # Create nodes 0 and 1 to mine.
8996 # Create node 2 to test pruning.
90- self .full_node_default_args = ["-dip3params=2000:2000" , "-testactivationheight=dip0008@2000" , "- maxreceivebuffer=20000" , "-blockmaxsize=999000" , "-checkblocks=5" ]
97+ self .full_node_default_args = ["-maxreceivebuffer=20000" , "-blockmaxsize=999000" , "-checkblocks=5" ] + DEPLOYMENT_ARGS
9198 # Create nodes 3 and 4 to test manual pruning (they will be re-started with manual pruning later)
9299 # Create nodes 5 to test wallet in prune mode, but do not connect
93100 self .extra_args = [
94101 self .full_node_default_args ,
95102 self .full_node_default_args ,
96- ["-dip3params=2000:2000" , "-testactivationheight=dip0008@2000" , "- disablegovernance" ,"-txindex=0" ,"-maxreceivebuffer=20000" ,"-prune=550" ],
97- ["-dip3params=2000:2000" , "-testactivationheight=dip0008@2000" , "- disablegovernance" ,"-txindex=0" ,"-maxreceivebuffer=20000" ,"-blockmaxsize=999000" ],
98- ["-dip3params=2000:2000" , "-testactivationheight=dip0008@2000" , "- disablegovernance" ,"-txindex=0" ,"-maxreceivebuffer=20000" ,"-blockmaxsize=999000" ],
99- ["-dip3params=2000:2000" , "-testactivationheight=dip0008@2000" , "- disablegovernance" ,"-txindex=0" ,"-prune=550" ],
103+ ["-disablegovernance" ,"-txindex=0" ,"-maxreceivebuffer=20000" ,"-prune=550" ] + DEPLOYMENT_ARGS ,
104+ ["-disablegovernance" ,"-txindex=0" ,"-maxreceivebuffer=20000" ,"-blockmaxsize=999000" ] + DEPLOYMENT_ARGS ,
105+ ["-disablegovernance" ,"-txindex=0" ,"-maxreceivebuffer=20000" ,"-blockmaxsize=999000" ] + DEPLOYMENT_ARGS ,
106+ ["-disablegovernance" ,"-txindex=0" ,"-prune=550" ] + DEPLOYMENT_ARGS ,
100107 ]
101108 self .rpc_timeout = 120
102109
@@ -213,7 +220,7 @@ def reorg_test(self):
213220 self .log .info ("New best height: %d" % self .nodes [1 ].getblockcount ())
214221
215222 # Mine one block to avoid automatic recovery from forks on restart
216- self .generate (self .nodes [1 ], 1 )
223+ self .generate (self .nodes [1 ], 1 , sync_fun = self . no_op )
217224 # Disconnect node1 and generate the new chain
218225 self .disconnect_nodes (0 , 1 )
219226 self .disconnect_nodes (1 , 2 )
@@ -283,13 +290,13 @@ def reorg_back(self):
283290
284291 def manual_test (self , node_number , use_timestamp ):
285292 # at this point, node has 995 blocks and has not yet run in prune mode
286- self .start_node (node_number , extra_args = ["-dip3params=2000:2000" , "-testactivationheight=dip0008@2000" , "- disablegovernance" , "-txindex=0" ])
293+ self .start_node (node_number , extra_args = ["-disablegovernance" , "-txindex=0" ] + DEPLOYMENT_ARGS )
287294 node = self .nodes [node_number ]
288295 assert_equal (node .getblockcount (), 995 )
289296 assert_raises_rpc_error (- 1 , "Cannot prune blocks because node is not in prune mode" , node .pruneblockchain , 500 )
290297
291298 # now re-start in manual pruning mode
292- self .restart_node (node_number , extra_args = ["-dip3params=2000:2000" , "-testactivationheight=dip0008@2000" , "- disablegovernance" , "-txindex=0" , "-prune=1" ], expected_stderr = EXPECTED_STDERR_NO_GOV )
299+ self .restart_node (node_number , extra_args = ["-disablegovernance" , "-txindex=0" , "-prune=1" ] + DEPLOYMENT_ARGS , expected_stderr = EXPECTED_STDERR_NO_GOV )
293300 node = self .nodes [node_number ]
294301 assert_equal (node .getblockcount (), 995 )
295302
@@ -358,14 +365,14 @@ def has_block(index):
358365 assert not has_block (3 ), "blk00003.dat is still there, should be pruned by now"
359366
360367 # stop node, start back up with auto-prune at 550 MiB, make sure still runs
361- self .restart_node (node_number , extra_args = ["-dip3params=2000:2000" , "-testactivationheight=dip0008@2000" , "- disablegovernance" , "-txindex=0" , "-prune=550" ], expected_stderr = EXPECTED_STDERR_NO_GOV_PRUNE )
368+ self .restart_node (node_number , extra_args = ["-disablegovernance" , "-txindex=0" , "-prune=550" ] + DEPLOYMENT_ARGS , expected_stderr = EXPECTED_STDERR_NO_GOV_PRUNE )
362369
363370 self .log .info ("Success" )
364371
365372 def wallet_test (self ):
366373 # check that the pruning node's wallet is still in good shape
367374 self .log .info ("Stop and start pruning node to trigger wallet rescan" )
368- self .restart_node (2 , extra_args = ["-dip3params=2000:2000" , "-testactivationheight=dip0008@2000" , "- disablegovernance" , "-txindex=0" , "-prune=550" ], expected_stderr = EXPECTED_STDERR_NO_GOV_PRUNE )
375+ self .restart_node (2 , extra_args = ["-disablegovernance" , "-txindex=0" , "-prune=550" ] + DEPLOYMENT_ARGS , expected_stderr = EXPECTED_STDERR_NO_GOV_PRUNE )
369376 self .log .info ("Success" )
370377
371378 # check that wallet loads successfully when restarting a pruned node after IBD.
@@ -374,7 +381,7 @@ def wallet_test(self):
374381 self .connect_nodes (0 , 5 )
375382 nds = [self .nodes [0 ], self .nodes [5 ]]
376383 self .sync_blocks (nds , wait = 5 , timeout = 300 )
377- self .restart_node (5 , extra_args = ["-dip3params=2000:2000" , "-testactivationheight=dip0008@2000" , "- disablegovernance" , "-txindex=0" , "-prune=550" ], expected_stderr = EXPECTED_STDERR_NO_GOV_PRUNE ) # restart to trigger rescan
384+ self .restart_node (5 , extra_args = ["-disablegovernance" , "-txindex=0" , "-prune=550" ] + DEPLOYMENT_ARGS , expected_stderr = EXPECTED_STDERR_NO_GOV_PRUNE ) # restart to trigger rescan
378385 self .log .info ("Success" )
379386
380387 def run_test (self ):
0 commit comments