Skip to content

Commit 1b1d8bd

Browse files
author
MarcoFalke
committed
Merge #21252: test: Add missing wait for sync to feature_blockfilterindex_prune
fa560cc test: Intermittent issue in feature_blockfilterindex_prune (MarcoFalke) Pull request description: https://cirrus-ci.com/task/4962244553342976?command=ci#L5131 The index is built in a background thread, so we have to wait for it. ACKs for top commit: jonatack: ACK fa560cc Tree-SHA512: e7a246fe43a28511581fe34b1f5a85303b1874b2535330afc0405269cce7306984ecc6af389791321e3aa4b224819e89d9b89dd5bc080d60baa20bd007412787
2 parents 2059d32 + fa560cc commit 1b1d8bd

File tree

1 file changed

+5
-3
lines changed

1 file changed

+5
-3
lines changed

test/functional/feature_blockfilterindex_prune.py

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,9 @@
55
"""Test blockfilterindex in conjunction with prune."""
66
from test_framework.test_framework import BitcoinTestFramework
77
from test_framework.util import (
8-
assert_raises_rpc_error,
8+
assert_equal,
99
assert_greater_than,
10+
assert_raises_rpc_error,
1011
)
1112

1213

@@ -16,17 +17,18 @@ def set_test_params(self):
1617
self.extra_args = [["-fastprune", "-prune=1"], ["-fastprune", "-prune=1", "-blockfilterindex=1"]]
1718

1819
def run_test(self):
19-
# test basic pruning compatibility & filter access of pruned blocks
2020
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}})
2122
assert len(self.nodes[1].getblockfilter(self.nodes[1].getbestblockhash())['filter']) > 0
2223
# Mine two batches of blocks to avoid hitting NODE_NETWORK_LIMITED_MIN_BLOCKS disconnection
2324
self.nodes[1].generate(250)
2425
self.sync_all()
2526
self.nodes[1].generate(250)
2627
self.sync_all()
28+
self.wait_until(lambda: self.nodes[1].getindexinfo() == {'basic block filter index': {'synced': True, 'best_block_height': 700}})
2729
self.log.info("prune some blocks")
2830
pruneheight = self.nodes[1].pruneblockchain(400)
29-
assert pruneheight != 0
31+
assert_equal(pruneheight, 250)
3032
self.log.info("check if we can access the tips blockfilter when we have pruned some blocks")
3133
assert len(self.nodes[1].getblockfilter(self.nodes[1].getbestblockhash())['filter']) > 0
3234
self.log.info("check if we can access the blockfilter of a pruned block")

0 commit comments

Comments
 (0)