@@ -19,6 +19,17 @@ def set_test_params(self):
1919 self .setup_clean_chain = True
2020 self .num_nodes = 1
2121
22+ def check_expected_network (self , node , active ):
23+ rev_file = node .blocks_path / "rev00000.dat"
24+ bogus_file = node .blocks_path / "bogus.dat"
25+ rev_file .rename (bogus_file )
26+ assert_raises_rpc_error (
27+ - 1 , 'Could not roll back to requested height.' , node .dumptxoutset , 'utxos.dat' , rollback = 99 )
28+ assert_equal (node .getnetworkinfo ()['networkactive' ], active )
29+
30+ # Cleanup
31+ bogus_file .rename (rev_file )
32+
2233 def run_test (self ):
2334 """Test a trivial usage of the dumptxoutset RPC command."""
2435 node = self .nodes [0 ]
@@ -60,16 +71,14 @@ def run_test(self):
6071 assert_raises_rpc_error (
6172 - 8 , 'Invalid snapshot type "bogus" specified. Please specify "rollback" or "latest"' , node .dumptxoutset , 'utxos.dat' , "bogus" )
6273
63- self .log .info (f"Test that dumptxoutset failure does not leave the network activity suspended" )
64- rev_file = node . blocks_path / "rev00000.dat"
65- bogus_file = node . blocks_path / "bogus.dat"
66- rev_file . rename ( bogus_file )
67- assert_raises_rpc_error (
68- - 1 , 'Could not roll back to requested height.' , node . dumptxoutset , 'utxos.dat' , rollback = 99 )
69- assert_equal ( node .getnetworkinfo ()[ 'networkactive' ], True )
74+ self .log .info (f"Test that dumptxoutset failure does not leave the network activity suspended when it was on previously " )
75+ self . check_expected_network ( node , True )
76+
77+ self . log . info ( f"Test that dumptxoutset failure leaves the network activity suspended when it was off" )
78+ node . setnetworkactive ( False )
79+ self . check_expected_network ( node , False )
80+ node .setnetworkactive ( True )
7081
71- # Cleanup
72- bogus_file .rename (rev_file )
7382
7483if __name__ == '__main__' :
7584 DumptxoutsetTest (__file__ ).main ()
0 commit comments