Skip to content

Commit bac43b9

Browse files
committed
Merge bitcoin/bitcoin#32312: test: Fix feature_pruning test after nTime typo fix
2aa63d5 test: Use uninvolved pruned node in feature_pruning undo test (enoch) 772ba7f test: Fix nTimes typo in feature_pruning test (enoch) Pull request description: This PR contains two commits: 1. Fixes a typo in feature_pruning.py where 'nTimes' was incorrectly used instead of 'nTime'. This typo caused the test to always reset mine_large_blocks.nTime to 0, rather than only on the first run. 2. Fixes the test failure exposed by the typo fix. The test_pruneheight_undo_presence test was failing because it was using node 2, which is involved in reorg testing and could be on a different chain than other nodes. The solution switches to using node 5, which is also a pruned node but isn't involved in reorg testing. Testing: - Ran test/functional/feature_pruning.py multiple times to verify consistent passing - Verified that the test now passes with the correct nTime variable name - Confirmed the test behavior matches the intended functionality of verifying pruned block availability - Ran the full test suite to ensure the changes did not introduce any regressions or affect other tests Thanks to fjahr for his assistance in diagnosing the issue and suggesting the solution. This fixes the test failure reported in #32249 ACKs for top commit: fjahr: tACK 2aa63d5 maflcko: lgtm ACK 2aa63d5 naiyoma: tACK 2aa63d5 stratospher: tested ACK 2aa63d5. verified that `nTime` is being incremented now. Tree-SHA512: a543528fd4eeb30e978c0b43cfa109768252edaf1f94679dbbc7fe684122c00da34224e2cc1abd2a265af1b267eef1cd34246207946cf7d8e93d2c0f11aa56d8
2 parents c9ab109 + 2aa63d5 commit bac43b9

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

test/functional/feature_pruning.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ def mine_large_blocks(node, n):
4141
# Set the nTime if this is the first time this function has been called.
4242
# A static variable ensures that time is monotonicly increasing and is therefore
4343
# different for each block created => blockhash is unique.
44-
if "nTimes" not in mine_large_blocks.__dict__:
44+
if "nTime" not in mine_large_blocks.__dict__:
4545
mine_large_blocks.nTime = 0
4646

4747
# Get the block parameters for the first block
@@ -498,11 +498,11 @@ def test_scanblocks_pruned(self):
498498
"start", [{"desc": f"raw({false_positive_spk.hex()})"}], 0, 0, "basic", {"filter_false_positives": True})
499499

500500
def test_pruneheight_undo_presence(self):
501-
node = self.nodes[2]
501+
node = self.nodes[5]
502502
pruneheight = node.getblockchaininfo()["pruneheight"]
503503
fetch_block = node.getblockhash(pruneheight - 1)
504504

505-
self.connect_nodes(1, 2)
505+
self.connect_nodes(1, 5)
506506
peers = node.getpeerinfo()
507507
node.getblockfrompeer(fetch_block, peers[0]["id"])
508508
self.wait_until(lambda: not try_rpc(-1, "Block not available (pruned data)", node.getblock, fetch_block), timeout=5)

0 commit comments

Comments
 (0)