Skip to content

Commit 88c4b9b

Browse files
committed
test: remove unneeded node from feature_blockfilterindex_prune.py
1 parent ace3f4c commit 88c4b9b

File tree

1 file changed

+17
-20
lines changed

1 file changed

+17
-20
lines changed

test/functional/feature_blockfilterindex_prune.py

Lines changed: 17 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -13,55 +13,52 @@
1313

1414
class FeatureBlockfilterindexPruneTest(BitcoinTestFramework):
1515
def set_test_params(self):
16-
self.num_nodes = 2
17-
self.extra_args = [["-fastprune", "-prune=1"], ["-fastprune", "-prune=1", "-blockfilterindex=1"]]
16+
self.num_nodes = 1
17+
self.extra_args = [["-fastprune", "-prune=1", "-blockfilterindex=1"]]
1818

1919
def sync_index(self, height):
2020
expected = {'basic block filter index': {'synced': True, 'best_block_height': height}}
21-
self.wait_until(lambda: self.nodes[1].getindexinfo() == expected)
21+
self.wait_until(lambda: self.nodes[0].getindexinfo() == expected)
2222

2323
def run_test(self):
2424
self.log.info("check if we can access a blockfilter when pruning is enabled but no blocks are actually pruned")
2525
self.sync_index(height=200)
26-
assert_greater_than(len(self.nodes[1].getblockfilter(self.nodes[1].getbestblockhash())['filter']), 0)
26+
assert_greater_than(len(self.nodes[0].getblockfilter(self.nodes[0].getbestblockhash())['filter']), 0)
2727
# Mine two batches of blocks to avoid hitting NODE_NETWORK_LIMITED_MIN_BLOCKS disconnection
28-
self.nodes[1].generate(250)
28+
self.nodes[0].generate(250)
2929
self.sync_all()
30-
self.nodes[1].generate(250)
30+
self.nodes[0].generate(250)
3131
self.sync_all()
3232
self.sync_index(height=700)
3333

3434
self.log.info("prune some blocks")
35-
pruneheight = self.nodes[1].pruneblockchain(400)
35+
pruneheight = self.nodes[0].pruneblockchain(400)
3636
assert_equal(pruneheight, 250)
3737

3838
self.log.info("check if we can access the tips blockfilter when we have pruned some blocks")
39-
assert_greater_than(len(self.nodes[1].getblockfilter(self.nodes[1].getbestblockhash())['filter']), 0)
39+
assert_greater_than(len(self.nodes[0].getblockfilter(self.nodes[0].getbestblockhash())['filter']), 0)
4040

4141
self.log.info("check if we can access the blockfilter of a pruned block")
42-
assert_greater_than(len(self.nodes[1].getblockfilter(self.nodes[1].getblockhash(2))['filter']), 0)
42+
assert_greater_than(len(self.nodes[0].getblockfilter(self.nodes[0].getblockhash(2))['filter']), 0)
4343

4444
self.log.info("start node without blockfilterindex")
45-
self.stop_node(1)
46-
self.start_node(1, extra_args=self.extra_args[0])
45+
self.restart_node(0, extra_args=["-fastprune", "-prune=1"])
4746

4847
self.log.info("make sure accessing the blockfilters throws an error")
49-
assert_raises_rpc_error(-1, "Index is not enabled for filtertype basic", self.nodes[1].getblockfilter, self.nodes[1].getblockhash(2))
50-
self.nodes[1].generate(1000)
48+
assert_raises_rpc_error(-1, "Index is not enabled for filtertype basic", self.nodes[0].getblockfilter, self.nodes[0].getblockhash(2))
49+
self.nodes[0].generate(1000)
5150

5251
self.log.info("prune below the blockfilterindexes best block while blockfilters are disabled")
53-
pruneheight_new = self.nodes[1].pruneblockchain(1000)
52+
pruneheight_new = self.nodes[0].pruneblockchain(1000)
5453
assert_greater_than(pruneheight_new, pruneheight)
55-
self.stop_node(1)
54+
self.stop_node(0)
5655

5756
self.log.info("make sure we get an init error when starting the node again with block filters")
58-
with self.nodes[1].assert_debug_log(["basic block filter index best block of the index goes beyond pruned data. Please disable the index or reindex (which will download the whole blockchain again)"]):
59-
self.nodes[1].assert_start_raises_init_error(extra_args=self.extra_args[1])
57+
with self.nodes[0].assert_debug_log(["basic block filter index best block of the index goes beyond pruned data. Please disable the index or reindex (which will download the whole blockchain again)"]):
58+
self.nodes[0].assert_start_raises_init_error(extra_args=["-fastprune", "-prune=1", "-blockfilterindex=1"])
6059

6160
self.log.info("make sure the node starts again with the -reindex arg")
62-
reindex_args = self.extra_args[1]
63-
reindex_args.append("-reindex")
64-
self.start_node(1, extra_args=reindex_args)
61+
self.start_node(0, extra_args = ["-fastprune", "-prune=1", "-blockfilterindex", "-reindex"])
6562

6663

6764
if __name__ == '__main__':

0 commit comments

Comments
 (0)