Skip to content

Commit 6586bc3

Browse files
committed
Merge pull request #3502
1f12844 Fix importprivkey / rescan (Cozz Lovan)
2 parents 250b4bc + 1f12844 commit 6586bc3

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

src/rpcdump.cpp

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -116,9 +116,14 @@ Value importprivkey(const Array& params, bool fHelp)
116116
if (pwalletMain->HaveKey(vchAddress))
117117
return Value::null;
118118

119+
pwalletMain->mapKeyMetadata[vchAddress].nCreateTime = 1;
120+
119121
if (!pwalletMain->AddKeyPubKey(key, pubkey))
120122
throw JSONRPCError(RPC_WALLET_ERROR, "Error adding key to wallet");
121123

124+
// whenever a key is imported, we need to scan the whole chain
125+
pwalletMain->nTimeFirstKey = 1; // 0 would be considered 'no value'
126+
122127
if (fRescan) {
123128
pwalletMain->ScanForWalletTransactions(chainActive.Genesis(), true);
124129
pwalletMain->ReacceptWalletTransactions();

0 commit comments

Comments
 (0)