Skip to content

Commit 592016b

Browse files
promagMarcoFalke
authored andcommitted
fixup: Fix prunning test
Github-Pull: bitcoin#15991 Rebased-From: f402012
1 parent c80a498 commit 592016b

File tree

1 file changed

+4
-17
lines changed

1 file changed

+4
-17
lines changed

test/functional/feature_pruning.py

Lines changed: 4 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -10,12 +10,10 @@
1010
"""
1111

1212
from test_framework.test_framework import BitcoinTestFramework
13-
from test_framework.util import assert_equal, assert_greater_than, assert_raises_rpc_error, connect_nodes, mine_large_block, sync_blocks, wait_until
13+
from test_framework.util import assert_equal, assert_raises_rpc_error, connect_nodes, mine_large_block, sync_blocks, wait_until
1414

1515
import os
1616

17-
MIN_BLOCKS_TO_KEEP = 288
18-
1917
# Rescans start at the earliest block up to 2 hours before a key timestamp, so
2018
# the manual prune RPC avoids pruning blocks in the same window to be
2119
# compatible with pruning based on key creation time.
@@ -250,20 +248,9 @@ def height(index):
250248
else:
251249
return index
252250

253-
def prune(index, expected_ret=None):
251+
def prune(index):
254252
ret = node.pruneblockchain(height=height(index))
255-
# Check the return value. When use_timestamp is True, just check
256-
# that the return value is less than or equal to the expected
257-
# value, because when more than one block is generated per second,
258-
# a timestamp will not be granular enough to uniquely identify an
259-
# individual block.
260-
if expected_ret is None:
261-
expected_ret = index
262-
if use_timestamp:
263-
assert_greater_than(ret, 0)
264-
assert_greater_than(expected_ret + 1, ret)
265-
else:
266-
assert_equal(ret, expected_ret)
253+
assert_equal(ret, node.getblockchaininfo()['pruneheight'])
267254

268255
def has_block(index):
269256
return os.path.isfile(os.path.join(self.nodes[node_number].datadir, "regtest", "blocks", "blk{:05}.dat".format(index)))
@@ -308,7 +295,7 @@ def has_block(index):
308295
raise AssertionError("blk00001.dat is still there, should be pruned by now")
309296

310297
# height=1000 should not prune anything more, because tip-288 is in blk00002.dat.
311-
prune(1000, 1001 - MIN_BLOCKS_TO_KEEP)
298+
prune(1000)
312299
if not has_block(2):
313300
raise AssertionError("blk00002.dat is still there, should be pruned by now")
314301

0 commit comments

Comments
 (0)