Initial implementation of getrescaninfo

This commit is contained in:
Duke Leto
2022-10-17 07:03:32 -04:00
parent c049575357
commit 71923e3ffb
4 changed files with 49 additions and 5 deletions

View File

@@ -2760,6 +2760,7 @@ int CWallet::ScanForWalletTransactions(CBlockIndex* pindexStart, bool fUpdate)
if(fZdebug)
LogPrintf("%s: fUpdate=%d now=%li\n",__func__,fUpdate,nNow);
pwalletMain->fRescanning = true;
CBlockIndex* pindex = pindexStart;
{
LOCK2(cs_main, cs_wallet);
@@ -2772,8 +2773,11 @@ int CWallet::ScanForWalletTransactions(CBlockIndex* pindexStart, bool fUpdate)
ShowProgress(_("Rescanning..."), 0); // show rescan progress in GUI as dialog or on splashscreen, if -rescan on startup
double dProgressStart = Checkpoints::GuessVerificationProgress(chainParams.Checkpoints(), pindex, false);
double dProgressTip = Checkpoints::GuessVerificationProgress(chainParams.Checkpoints(), chainActive.LastTip(), false);
pwalletMain->rescanStartHeight = pindex->GetHeight();
while (pindex)
{
pwalletMain->rescanHeight = pindex->GetHeight();
if (pindex->GetHeight() % 100 == 0 && dProgressTip - dProgressStart > 0.0)
ShowProgress(_("Rescanning..."), std::max(1, std::min(99, (int)((Checkpoints::GuessVerificationProgress(chainParams.Checkpoints(), pindex, false) - dProgressStart) / (dProgressTip - dProgressStart) * 100))));
@@ -2825,6 +2829,9 @@ int CWallet::ScanForWalletTransactions(CBlockIndex* pindexStart, bool fUpdate)
ShowProgress(_("Rescanning..."), 100); // hide progress dialog in GUI
}
// we are no longer rescanning
pwalletMain->fRescanning = false;
return ret;
}