aboutsummaryrefslogtreecommitdiff
path: root/qa/rpc-tests/pruning.py
diff options
context:
space:
mode:
Diffstat (limited to 'qa/rpc-tests/pruning.py')
-rwxr-xr-xqa/rpc-tests/pruning.py19
1 files changed, 11 insertions, 8 deletions
diff --git a/qa/rpc-tests/pruning.py b/qa/rpc-tests/pruning.py
index 9d155478e2..ace8ced422 100755
--- a/qa/rpc-tests/pruning.py
+++ b/qa/rpc-tests/pruning.py
@@ -2,14 +2,12 @@
# Copyright (c) 2014-2016 The Bitcoin Core developers
# Distributed under the MIT software license, see the accompanying
# file COPYING or http://www.opensource.org/licenses/mit-license.php.
+"""Test the pruning code.
-#
-# Test pruning code
-# ********
-# WARNING:
-# This test uses 4GB of disk space.
-# This test takes 30 mins or more (up to 2 hours)
-# ********
+WARNING:
+This test uses 4GB of disk space.
+This test takes 30 mins or more (up to 2 hours)
+"""
from test_framework.test_framework import BitcoinTestFramework
from test_framework.util import *
@@ -18,6 +16,11 @@ import os
MIN_BLOCKS_TO_KEEP = 288
+# Rescans start at the earliest block up to 2 hours before a key timestamp, so
+# the manual prune RPC avoids pruning blocks in the same window to be
+# compatible with pruning based on key creation time.
+RESCAN_WINDOW = 2 * 60 * 60
+
def calc_usage(blockdir):
return sum(os.path.getsize(blockdir+f) for f in os.listdir(blockdir) if os.path.isfile(blockdir+f)) / (1024. * 1024.)
@@ -239,7 +242,7 @@ class PruneTest(BitcoinTestFramework):
def height(index):
if use_timestamp:
- return node.getblockheader(node.getblockhash(index))["time"]
+ return node.getblockheader(node.getblockhash(index))["time"] + RESCAN_WINDOW
else:
return index