aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCozz Lovan <cozzlovan@yahoo.com>2014-01-09 20:23:20 +0100
committerCozz Lovan <cozzlovan@yahoo.com>2014-01-18 18:47:32 +0100
commit1f12844fc03dfc1863ea9a5096f8650c64a0b2ac (patch)
tree35f3d139001b7699ccfaeb391abdf32f9f0f7be9
parent13e99e463d4aa0bd2b2892010ca8c7007c40c242 (diff)
Fix importprivkey / rescan
-rw-r--r--src/rpcdump.cpp5
1 files changed, 5 insertions, 0 deletions
diff --git a/src/rpcdump.cpp b/src/rpcdump.cpp
index c801b284cb..18c8bb6e61 100644
--- a/src/rpcdump.cpp
+++ b/src/rpcdump.cpp
@@ -116,9 +116,14 @@ Value importprivkey(const Array& params, bool fHelp)
if (pwalletMain->HaveKey(vchAddress))
return Value::null;
+ pwalletMain->mapKeyMetadata[vchAddress].nCreateTime = 1;
+
if (!pwalletMain->AddKeyPubKey(key, pubkey))
throw JSONRPCError(RPC_WALLET_ERROR, "Error adding key to wallet");
+ // whenever a key is imported, we need to scan the whole chain
+ pwalletMain->nTimeFirstKey = 1; // 0 would be considered 'no value'
+
if (fRescan) {
pwalletMain->ScanForWalletTransactions(chainActive.Genesis(), true);
pwalletMain->ReacceptWalletTransactions();