diff options
author | Wladimir J. van der Laan <laanwj@gmail.com> | 2017-03-17 20:34:55 +0100 |
---|---|---|
committer | Wladimir J. van der Laan <laanwj@gmail.com> | 2017-03-17 21:52:14 +0100 |
commit | 3d857f307be8712b9b251e770d8425717409654b (patch) | |
tree | 6392499060f4ef0f915e7ffa71212a275360bea2 /qa | |
parent | 9c7b7cf0bb579714b35f7c88db20a407dfc716bd (diff) | |
parent | 7759aa23d1db88230b67703f8e3235afa9225c08 (diff) |
Merge #9818: Save watch only key timestamps when reimporting keys
7759aa2 Save watch only key timestamps when reimporting keys (Russell Yanofsky)
Tree-SHA512: 433b5a78e5626fb2f3166e6c84c22eabd5239d451dc82694da95af237e034612a24f1a8bc959b7d2f2e576ce0b679be1fa4af929ebfae758c7e832056ab67061
Diffstat (limited to 'qa')
-rwxr-xr-x | qa/rpc-tests/importmulti.py | 19 |
1 files changed, 19 insertions, 0 deletions
diff --git a/qa/rpc-tests/importmulti.py b/qa/rpc-tests/importmulti.py index 298b6e9b86..ca5d42eced 100755 --- a/qa/rpc-tests/importmulti.py +++ b/qa/rpc-tests/importmulti.py @@ -314,6 +314,7 @@ class ImportMultiTest (BitcoinTestFramework): self.nodes[1].generate(100) transactionid = self.nodes[1].sendtoaddress(multi_sig_script['address'], 10.00) self.nodes[1].generate(1) + timestamp = self.nodes[1].getblock(self.nodes[1].getbestblockhash())['mediantime'] transaction = self.nodes[1].gettransaction(transactionid) self.log.info("Should import a p2sh with respective redeem script and private keys") @@ -409,6 +410,24 @@ class ImportMultiTest (BitcoinTestFramework): assert_equal(address_assert['ismine'], False) assert_equal('timestamp' in address_assert, False) + + # Importing existing watch only address with new timestamp should replace saved timestamp. + assert_greater_than(timestamp, watchonly_timestamp) + print("Should replace previously saved watch only timestamp.") + result = self.nodes[1].importmulti([{ + "scriptPubKey": { + "address": watchonly_address, + }, + "timestamp": "now", + }]) + assert_equal(result[0]['success'], True) + address_assert = self.nodes[1].validateaddress(watchonly_address) + assert_equal(address_assert['iswatchonly'], True) + assert_equal(address_assert['ismine'], False) + assert_equal(address_assert['timestamp'], timestamp) + watchonly_timestamp = timestamp + + # restart nodes to check for proper serialization/deserialization of watch only address stop_nodes(self.nodes) self.nodes = start_nodes(2, self.options.tmpdir) |