diff options
author | Russell Yanofsky <russ@yanofsky.org> | 2017-02-14 17:39:26 -0500 |
---|---|---|
committer | Russell Yanofsky <russ@yanofsky.org> | 2017-02-16 09:05:55 -0500 |
commit | e662af358305b9fa4da772ec37c8356a9fc92ab6 (patch) | |
tree | 3af65e84fbad7dafc5ea8b7a31d4698434f55d58 /qa | |
parent | 38d3e9ee5900dffb02207211ad5da8f0751e4605 (diff) |
Use 2 hour grace period for key timestamps in importmulti rescans
Gregory Maxwell <greg@xiph.org> pointed out the lack of grace period in
https://github.com/bitcoin/bitcoin/pull/9490#issue-199407998.
The importwallet RPC which uses key timestamps in a similar way already has a 2
hour grace period.
Diffstat (limited to 'qa')
-rwxr-xr-x | qa/rpc-tests/import-rescan.py | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/qa/rpc-tests/import-rescan.py b/qa/rpc-tests/import-rescan.py index bd03491f11..54cc6d2642 100755 --- a/qa/rpc-tests/import-rescan.py +++ b/qa/rpc-tests/import-rescan.py @@ -54,7 +54,7 @@ class Variant(collections.namedtuple("Variant", "call data rescan prune")): "scriptPubKey": { "address": self.address["address"] }, - "timestamp": timestamp + (1 if self.rescan == Rescan.late_timestamp else 0), + "timestamp": timestamp + RESCAN_WINDOW + (1 if self.rescan == Rescan.late_timestamp else 0), "pubkeys": [self.address["pubkey"]] if self.data == Data.pub else [], "keys": [self.key] if self.data == Data.priv else [], "label": self.label, @@ -99,6 +99,9 @@ IMPORT_VARIANTS = [Variant(*variants) for variants in itertools.product(Call, Da ImportNode = collections.namedtuple("ImportNode", "prune rescan") IMPORT_NODES = [ImportNode(*fields) for fields in itertools.product((False, True), repeat=2)] +# Rescans start at the earliest block up to 2 hours before the key timestamp. +RESCAN_WINDOW = 2 * 60 * 60 + class ImportRescanTest(BitcoinTestFramework): def __init__(self): @@ -130,7 +133,7 @@ class ImportRescanTest(BitcoinTestFramework): self.nodes[0].generate(1) assert_equal(self.nodes[0].getrawmempool(), []) timestamp = self.nodes[0].getblockheader(self.nodes[0].getbestblockhash())["time"] - set_node_times(self.nodes, timestamp + 1) + set_node_times(self.nodes, timestamp + RESCAN_WINDOW + 1) self.nodes[0].generate(1) sync_blocks(self.nodes) |