Browse Source

Merge pull request #3502

1f12844 Fix importprivkey / rescan (Cozz Lovan)
0.10
Wladimir J. van der Laan 11 years ago
parent
commit
6586bc3b51
No known key found for this signature in database
GPG Key ID: 74810B012346C9A6
  1. 5
      src/rpcdump.cpp

5
src/rpcdump.cpp

@ -116,9 +116,14 @@ Value importprivkey(const Array& params, bool fHelp)
if (pwalletMain->HaveKey(vchAddress)) if (pwalletMain->HaveKey(vchAddress))
return Value::null; return Value::null;
pwalletMain->mapKeyMetadata[vchAddress].nCreateTime = 1;
if (!pwalletMain->AddKeyPubKey(key, pubkey)) if (!pwalletMain->AddKeyPubKey(key, pubkey))
throw JSONRPCError(RPC_WALLET_ERROR, "Error adding key to wallet"); 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) { if (fRescan) {
pwalletMain->ScanForWalletTransactions(chainActive.Genesis(), true); pwalletMain->ScanForWalletTransactions(chainActive.Genesis(), true);
pwalletMain->ReacceptWalletTransactions(); pwalletMain->ReacceptWalletTransactions();

Loading…
Cancel
Save