@@ -19,6 +19,17 @@ def set_test_params(self):
19
19
self .setup_clean_chain = True
20
20
self .num_nodes = 1
21
21
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
+
22
33
def run_test (self ):
23
34
"""Test a trivial usage of the dumptxoutset RPC command."""
24
35
node = self .nodes [0 ]
@@ -60,16 +71,14 @@ def run_test(self):
60
71
assert_raises_rpc_error (
61
72
- 8 , 'Invalid snapshot type "bogus" specified. Please specify "rollback" or "latest"' , node .dumptxoutset , 'utxos.dat' , "bogus" )
62
73
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 )
70
81
71
- # Cleanup
72
- bogus_file .rename (rev_file )
73
82
74
83
if __name__ == '__main__' :
75
84
DumptxoutsetTest (__file__ ).main ()
0 commit comments