Skip to content

Commit

Permalink
Wallet rescan fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
levoncrypto committed Aug 12, 2024
1 parent b1b7ebe commit f9df2a0
Showing 1 changed file with 9 additions and 4 deletions.
13 changes: 9 additions & 4 deletions src/wallet/wallet.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2416,11 +2416,16 @@ CBlockIndex* CWallet::ScanForWalletTransactions(CBlockIndex *pindexStart, bool f
pindex = chainActive[chainParams.GetConsensus().nMnemonicBlock];
}
} else {
if (nTimeFirstKey < mnemonicStartBlock->GetBlockTime())
pindex = chainActive.Genesis();
else {
pindex = chainActive[chainParams.GetConsensus().nMnemonicBlock];
bool fRescan = GetBoolArg("-rescan", false);
if (fRescan) {
if (nTimeFirstKey < mnemonicStartBlock->GetBlockTime())
pindex = chainActive.Genesis();
else
pindex = mnemonicStartBlock;
}
else
while (pindex && nTimeFirstKey && (pindex->GetBlockTime() < (nTimeFirstKey - 7200)))
pindex = chainActive.Next(pindex);
}

LogPrintf("Rescanning last %i blocks (from block %i)...\n", chainActive.Height(), pindex->nHeight);
Expand Down

0 comments on commit f9df2a0

Please sign in to comment.