5
5
"""Test blockfilterindex in conjunction with prune."""
6
6
from test_framework .test_framework import BitcoinTestFramework
7
7
from test_framework .util import (
8
- assert_raises_rpc_error ,
8
+ assert_equal ,
9
9
assert_greater_than ,
10
+ assert_raises_rpc_error ,
10
11
)
11
12
12
13
@@ -16,17 +17,18 @@ def set_test_params(self):
16
17
self .extra_args = [["-fastprune" , "-prune=1" ], ["-fastprune" , "-prune=1" , "-blockfilterindex=1" ]]
17
18
18
19
def run_test (self ):
19
- # test basic pruning compatibility & filter access of pruned blocks
20
20
self .log .info ("check if we can access a blockfilter when pruning is enabled but no blocks are actually pruned" )
21
+ self .wait_until (lambda : self .nodes [1 ].getindexinfo () == {'basic block filter index' : {'synced' : True , 'best_block_height' : 200 }})
21
22
assert len (self .nodes [1 ].getblockfilter (self .nodes [1 ].getbestblockhash ())['filter' ]) > 0
22
23
# Mine two batches of blocks to avoid hitting NODE_NETWORK_LIMITED_MIN_BLOCKS disconnection
23
24
self .nodes [1 ].generate (250 )
24
25
self .sync_all ()
25
26
self .nodes [1 ].generate (250 )
26
27
self .sync_all ()
28
+ self .wait_until (lambda : self .nodes [1 ].getindexinfo () == {'basic block filter index' : {'synced' : True , 'best_block_height' : 700 }})
27
29
self .log .info ("prune some blocks" )
28
30
pruneheight = self .nodes [1 ].pruneblockchain (400 )
29
- assert pruneheight != 0
31
+ assert_equal ( pruneheight , 250 )
30
32
self .log .info ("check if we can access the tips blockfilter when we have pruned some blocks" )
31
33
assert len (self .nodes [1 ].getblockfilter (self .nodes [1 ].getbestblockhash ())['filter' ]) > 0
32
34
self .log .info ("check if we can access the blockfilter of a pruned block" )
0 commit comments