9
9
assert_greater_than ,
10
10
)
11
11
12
+
12
13
class FeatureBlockfilterindexPruneTest (BitcoinTestFramework ):
13
14
def set_test_params (self ):
14
15
self .num_nodes = 2
@@ -17,21 +18,21 @@ def set_test_params(self):
17
18
def run_test (self ):
18
19
# test basic pruning compatibility & filter access of pruned blocks
19
20
self .log .info ("check if we can access a blockfilter when pruning is enabled but no blocks are actually pruned" )
20
- assert ( len (self .nodes [1 ].getblockfilter (self .nodes [1 ].getbestblockhash ())['filter' ]) > 0 )
21
+ assert len (self .nodes [1 ].getblockfilter (self .nodes [1 ].getbestblockhash ())['filter' ]) > 0
21
22
self .nodes [1 ].generate (500 )
22
23
self .sync_all ()
23
24
self .log .info ("prune some blocks" )
24
25
pruneheight = self .nodes [1 ].pruneblockchain (400 )
25
- assert ( pruneheight != 0 )
26
+ assert pruneheight != 0
26
27
self .log .info ("check if we can access the tips blockfilter when we have pruned some blocks" )
27
- assert ( len (self .nodes [1 ].getblockfilter (self .nodes [1 ].getbestblockhash ())['filter' ]) > 0 )
28
+ assert len (self .nodes [1 ].getblockfilter (self .nodes [1 ].getbestblockhash ())['filter' ]) > 0
28
29
self .log .info ("check if we can access the blockfilter of a pruned block" )
29
- assert ( len (self .nodes [1 ].getblockfilter (self .nodes [1 ].getblockhash (2 ))['filter' ]) > 0 )
30
+ assert len (self .nodes [1 ].getblockfilter (self .nodes [1 ].getblockhash (2 ))['filter' ]) > 0
30
31
self .log .info ("start node without blockfilterindex" )
31
32
self .stop_node (1 )
32
33
self .start_node (1 , extra_args = self .extra_args [0 ])
33
34
self .log .info ("make sure accessing the blockfilters throws an error" )
34
- assert_raises_rpc_error (- 1 ,"Index is not enabled for filtertype basic" , self .nodes [1 ].getblockfilter , self .nodes [1 ].getblockhash (2 ))
35
+ assert_raises_rpc_error (- 1 , "Index is not enabled for filtertype basic" , self .nodes [1 ].getblockfilter , self .nodes [1 ].getblockhash (2 ))
35
36
self .nodes [1 ].generate (1000 )
36
37
self .log .info ("prune below the blockfilterindexes best block while blockfilters are disabled" )
37
38
pruneheight_new = self .nodes [1 ].pruneblockchain (1000 )
@@ -45,5 +46,6 @@ def run_test(self):
45
46
reindex_args .append ("-reindex" )
46
47
self .start_node (1 , extra_args = reindex_args )
47
48
49
+
48
50
if __name__ == '__main__' :
49
51
FeatureBlockfilterindexPruneTest ().main ()
0 commit comments