X-Git-Url: https://git.novaco.in/?a=blobdiff_plain;f=src%2Frpcdump.cpp;h=756863c9c8f19d04be4703e0698e7724e3d110d2;hb=05df71c9c292877e7469884227fd3ba84d02908b;hp=bb877bf1efa8ceaea01a77bba7bdde54965a6ac0;hpb=9e58e0a8ca28b15a4bfa677f5b23891972db40fd;p=novacoin.git diff --git a/src/rpcdump.cpp b/src/rpcdump.cpp index bb877bf..756863c 100644 --- a/src/rpcdump.cpp +++ b/src/rpcdump.cpp @@ -67,23 +67,22 @@ Value importprivkey(const Array& params, bool fHelp) { LOCK2(cs_main, pwalletMain->cs_wallet); - pwalletMain->MarkDirty(); - pwalletMain->SetAddressBookName(addr, strLabel); - // Don't throw error in case a key is already there if (pwalletMain->HaveKey(keyid)) return Value::null; pwalletMain->mapKeyMetadata[addr].nCreateTime = 1; - if (!pwalletMain->AddKey(key)) 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' + pwalletMain->MarkDirty(); + pwalletMain->SetAddressBookName(addr, strLabel); - if (fRescan) + if (fRescan) { + // whenever a key is imported, we need to scan the whole chain + pwalletMain->nTimeFirstKey = 1; // 0 would be considered 'no value' + pwalletMain->ScanForWalletTransactions(pindexGenesisBlock, true); pwalletMain->ReacceptWalletTransactions(); }