aboutsummaryrefslogtreecommitdiff
path: root/test/functional/feature_pruning.py
diff options
context:
space:
mode:
Diffstat (limited to 'test/functional/feature_pruning.py')
-rwxr-xr-xtest/functional/feature_pruning.py20
1 files changed, 19 insertions, 1 deletions
diff --git a/test/functional/feature_pruning.py b/test/functional/feature_pruning.py
index 4b548ef0f3..8d924282cf 100755
--- a/test/functional/feature_pruning.py
+++ b/test/functional/feature_pruning.py
@@ -25,6 +25,7 @@ from test_framework.util import (
assert_equal,
assert_greater_than,
assert_raises_rpc_error,
+ try_rpc,
)
# Rescans start at the earliest block up to 2 hours before a key timestamp, so
@@ -479,8 +480,12 @@ class PruneTest(BitcoinTestFramework):
self.log.info("Test invalid pruning command line options")
self.test_invalid_command_line_options()
+ self.log.info("Test scanblocks can not return pruned data")
self.test_scanblocks_pruned()
+ self.log.info("Test pruneheight reflects the presence of block and undo data")
+ self.test_pruneheight_undo_presence()
+
self.log.info("Done")
def test_scanblocks_pruned(self):
@@ -494,5 +499,18 @@ class PruneTest(BitcoinTestFramework):
assert_raises_rpc_error(-1, "Block not available (pruned data)", node.scanblocks,
"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]
+ pruneheight = node.getblockchaininfo()["pruneheight"]
+ fetch_block = node.getblockhash(pruneheight - 1)
+
+ self.connect_nodes(1, 2)
+ 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)
+
+ new_pruneheight = node.getblockchaininfo()["pruneheight"]
+ assert_equal(pruneheight, new_pruneheight)
+
if __name__ == '__main__':
- PruneTest().main()
+ PruneTest(__file__).main()