aboutsummaryrefslogtreecommitdiff
path: root/test/functional/feature_pruning.py
diff options
context:
space:
mode:
authorJohn Newbery <john@johnnewbery.com>2019-04-29 18:38:57 -0400
committerJohn Newbery <john@johnnewbery.com>2019-04-29 18:48:22 -0400
commit8728a66782d98fbd34ad9244c731537caa866a49 (patch)
tree3b92e787932a9a7f717998a75ddc3f48290e6fdd /test/functional/feature_pruning.py
parentdc5c2e4407463b6aadad2bee7495bb7576385cf8 (diff)
downloadbitcoin-8728a66782d98fbd34ad9244c731537caa866a49.tar.xz
[tests] fix block time in feature_pruning.py
Diffstat (limited to 'test/functional/feature_pruning.py')
-rwxr-xr-xtest/functional/feature_pruning.py13
1 files changed, 7 insertions, 6 deletions
diff --git a/test/functional/feature_pruning.py b/test/functional/feature_pruning.py
index 49951e24f3..cbeb2721da 100755
--- a/test/functional/feature_pruning.py
+++ b/test/functional/feature_pruning.py
@@ -28,16 +28,17 @@ def mine_large_blocks(node, n):
# followed by 950k of OP_NOP. This would be non-standard in a non-coinbase
# transaction but is consensus valid.
+ # Set the nTime if this is the first time this function has been called.
+ # A static variable ensures that time is monotonicly increasing and is therefore
+ # different for each block created => blockhash is unique.
+ if "nTimes" not in mine_large_blocks.__dict__:
+ mine_large_blocks.nTime = 0
+
# Get the block parameters for the first block
big_script = CScript([OP_RETURN] + [OP_NOP] * 950000)
best_block = node.getblock(node.getbestblockhash())
height = int(best_block["height"]) + 1
- try:
- # Static variable ensures that time is monotonicly increasing and is therefore
- # different for each block created => blockhash is unique.
- mine_large_blocks.nTime = min(mine_large_blocks.nTime, int(best_block["time"])) + 1
- except AttributeError:
- mine_large_blocks.nTime = int(best_block["time"]) + 1
+ mine_large_blocks.nTime = max(mine_large_blocks.nTime, int(best_block["time"])) + 1
previousblockhash = int(best_block["hash"], 16)
for _ in range(n):