From 772ba7f9ce09e836a51636524a8a96a23946d658 Mon Sep 17 00:00:00 2001 From: enoch Date: Mon, 21 Apr 2025 16:03:19 +0100 Subject: [PATCH 1/2] test: Fix nTimes typo in feature_pruning test Fix incorrect variable name in comment (nTimes -> nTime) in feature_pruning.py. This typo caused the test to always reset mine_large_blocks.nTime to 0, rather than only on the first run as intended. --- test/functional/feature_pruning.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/test/functional/feature_pruning.py b/test/functional/feature_pruning.py index 8d924282cfc..eeb2a78ba6f 100755 --- a/test/functional/feature_pruning.py +++ b/test/functional/feature_pruning.py @@ -41,7 +41,7 @@ def mine_large_blocks(node, n): # Set the nTime if this is the first time this function has been called. # A static variable ensures that time is monotonicly increasing and is therefore # different for each block created => blockhash is unique. - if "nTimes" not in mine_large_blocks.__dict__: + if "nTime" not in mine_large_blocks.__dict__: mine_large_blocks.nTime = 0 # Get the block parameters for the first block From 2aa63d511affdcc9980b58fc4ff18b8ad10b0f8c Mon Sep 17 00:00:00 2001 From: enoch Date: Mon, 21 Apr 2025 16:04:25 +0100 Subject: [PATCH 2/2] test: Use uninvolved pruned node in feature_pruning undo test After fixing the nTime variable name, the test_pruneheight_undo_presence test began failing because node 2, which is involved in reorg testing, could be on a different chain than other nodes. This caused failures when trying to fetch blocks from other nodes that didn't recognize node 2's chain. Switch to using node 5 instead, which is also a pruned node but isn't involved in reorg testing, ensuring it stays on the same chain as the other nodes. This allows the block fetching to work as intended in the test. --- test/functional/feature_pruning.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/test/functional/feature_pruning.py b/test/functional/feature_pruning.py index eeb2a78ba6f..02f1191ffef 100755 --- a/test/functional/feature_pruning.py +++ b/test/functional/feature_pruning.py @@ -500,11 +500,11 @@ class PruneTest(BitcoinTestFramework): "start", [{"desc": f"raw({false_positive_spk.hex()})"}], 0, 0, "basic", {"filter_false_positives": True}) def test_pruneheight_undo_presence(self): - node = self.nodes[2] + node = self.nodes[5] pruneheight = node.getblockchaininfo()["pruneheight"] fetch_block = node.getblockhash(pruneheight - 1) - self.connect_nodes(1, 2) + self.connect_nodes(1, 5) peers = node.getpeerinfo() node.getblockfrompeer(fetch_block, peers[0]["id"]) self.wait_until(lambda: not try_rpc(-1, "Block not available (pruned data)", node.getblock, fetch_block), timeout=5)