From 266a8114cbe2a87a6c84d7690a7716a18d782c56 Mon Sep 17 00:00:00 2001 From: Russell Yanofsky Date: Tue, 7 Feb 2017 11:08:08 -0500 Subject: [PATCH] Use MTP for importmulti "now" timestamps --- qa/rpc-tests/importmulti.py | 2 +- src/wallet/rpcdump.cpp | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/qa/rpc-tests/importmulti.py b/qa/rpc-tests/importmulti.py index b9874ccb855..52e40d6c1cc 100755 --- a/qa/rpc-tests/importmulti.py +++ b/qa/rpc-tests/importmulti.py @@ -139,7 +139,7 @@ class ImportMultiTest (BitcoinTestFramework): # Address + Private key + !watchonly print("Should import an address with private key") address = self.nodes[0].validateaddress(self.nodes[0].getnewaddress()) - timestamp = self.nodes[1].getblock(self.nodes[1].getbestblockhash())['time'] + timestamp = self.nodes[1].getblock(self.nodes[1].getbestblockhash())['mediantime'] result = self.nodes[1].importmulti([{ "scriptPubKey": { "address": address['address'] diff --git a/src/wallet/rpcdump.cpp b/src/wallet/rpcdump.cpp index 4674c95bfe6..9310a320c76 100644 --- a/src/wallet/rpcdump.cpp +++ b/src/wallet/rpcdump.cpp @@ -1034,7 +1034,7 @@ UniValue importmulti(const JSONRPCRequest& mainRequest) EnsureWalletIsUnlocked(); // Verify all timestamps are present before importing any keys. - const int64_t now = chainActive.Tip() ? chainActive.Tip()->GetBlockTime() : 0; + const int64_t now = chainActive.Tip() ? chainActive.Tip()->GetMedianTimePast() : 0; for (const UniValue& data : requests.getValues()) { GetImportTimestamp(data, now); }