Commit c5f0bd7b authored by Wladimir J. van der Laan's avatar Wladimir J. van der Laan
Browse files

Merge pull request #3502

1f12844f Fix importprivkey / rescan (Cozz Lovan)
parents 642dac9a 7f1b48bf
Showing with 5 additions and 0 deletions
+5 -0
......@@ -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();
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment