@@ -24,9 +24,7 @@ def run_test(self):
24
24
self .log .info ("check if we can access a blockfilter when pruning is enabled but no blocks are actually pruned" )
25
25
self .sync_index (height = 200 )
26
26
assert_greater_than (len (self .nodes [0 ].getblockfilter (self .nodes [0 ].getbestblockhash ())['filter' ]), 0 )
27
- # Mine two batches of blocks to avoid hitting NODE_NETWORK_LIMITED_MIN_BLOCKS disconnection
28
- self .generate (self .nodes [0 ], 250 )
29
- self .generate (self .nodes [0 ], 250 )
27
+ self .generate (self .nodes [0 ], 500 )
30
28
self .sync_index (height = 700 )
31
29
32
30
self .log .info ("prune some blocks" )
@@ -39,16 +37,29 @@ def run_test(self):
39
37
self .log .info ("check if we can access the blockfilter of a pruned block" )
40
38
assert_greater_than (len (self .nodes [0 ].getblockfilter (self .nodes [0 ].getblockhash (2 ))['filter' ]), 0 )
41
39
40
+ # mine and sync index up to a height that will later be the pruneheight
41
+ self .generate (self .nodes [0 ], 298 )
42
+ self .sync_index (height = 998 )
43
+
42
44
self .log .info ("start node without blockfilterindex" )
43
45
self .restart_node (0 , extra_args = ["-fastprune" , "-prune=1" ])
44
46
45
47
self .log .info ("make sure accessing the blockfilters throws an error" )
46
48
assert_raises_rpc_error (- 1 , "Index is not enabled for filtertype basic" , self .nodes [0 ].getblockfilter , self .nodes [0 ].getblockhash (2 ))
47
- self .generate (self .nodes [0 ], 1000 )
49
+ self .generate (self .nodes [0 ], 502 )
50
+
51
+ self .log .info ("prune exactly up to the blockfilterindexes best block while blockfilters are disabled" )
52
+ pruneheight_2 = self .nodes [0 ].pruneblockchain (1000 )
53
+ assert_equal (pruneheight_2 , 998 )
54
+ self .restart_node (0 , extra_args = ["-fastprune" , "-prune=1" , "-blockfilterindex=1" ])
55
+ self .log .info ("make sure that we can continue with the partially synced index after having pruned up to the index height" )
56
+ self .sync_index (height = 1500 )
48
57
49
58
self .log .info ("prune below the blockfilterindexes best block while blockfilters are disabled" )
50
- pruneheight_new = self .nodes [0 ].pruneblockchain (1000 )
51
- assert_greater_than (pruneheight_new , pruneheight )
59
+ self .restart_node (0 , extra_args = ["-fastprune" , "-prune=1" ])
60
+ self .generate (self .nodes [0 ], 1000 )
61
+ pruneheight_3 = self .nodes [0 ].pruneblockchain (2000 )
62
+ assert_greater_than (pruneheight_3 , pruneheight_2 )
52
63
self .stop_node (0 )
53
64
54
65
self .log .info ("make sure we get an init error when starting the node again with block filters" )
0 commit comments