aboutsummaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authorFabian Jahr <fjahr@protonmail.com>2024-03-17 15:57:38 +0100
committerFabian Jahr <fjahr@protonmail.com>2024-06-23 00:15:24 +0200
commit4a1975008b602aeacdad9a74d1837a7455148074 (patch)
tree79cb0d007707a8d95a7853f24254d4e9b8336d4b /test
parent96b4facc912927305b06a233cb8b36e7e5964c08 (diff)
rpc: Make pruneheight also reflect undo data presence
Diffstat (limited to 'test')
-rwxr-xr-xtest/functional/feature_pruning.py18
1 files changed, 18 insertions, 0 deletions
diff --git a/test/functional/feature_pruning.py b/test/functional/feature_pruning.py
index 4b548ef0f3..5f99b8dee8 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()