Skip to content

Commit

Permalink
scan optimisation fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
levoncrypto committed Aug 19, 2024
1 parent 08ed4d1 commit b9da4df
Showing 1 changed file with 5 additions and 4 deletions.
9 changes: 5 additions & 4 deletions src/wallet/wallet.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2416,21 +2416,22 @@ CBlockIndex* CWallet::ScanForWalletTransactions(CBlockIndex *pindexStart, bool f
if (!wcdate.empty()) {
pindex = GetBlockByDate(mnemonicStartBlock, wcdate);
if (pindex->nHeight < chainParams.GetConsensus().nMnemonicBlock) {
pindex = chainActive[chainParams.GetConsensus().nMnemonicBlock];
pindex = mnemonicStartBlock;
}
} else {
bool fRescan = GetBoolArg("-rescan", false);
if (fRescan) {
if (fRescan || fRecoverMnemonic) {
if (nTimeFirstKey < mnemonicStartBlock->GetBlockTime())
pindex = chainActive.Genesis();
pindex = chainActive.FindEarliestAtLeast(nTimeFirstKey);
else
pindex = mnemonicStartBlock;
if (pindex == NULL)
pindex = chainActive.Tip();
}
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);
ShowProgress(_("Rescanning..."), 0); // show rescan progress in GUI as dialog or on splashscreen, if -rescan on startup
double dProgressStart = GuessVerificationProgress(chainParams.TxData(), pindex);
Expand Down

0 comments on commit b9da4df

Please sign in to comment.