Changeset View
Changeset View
Standalone View
Standalone View
src/wallet/wallet.cpp
Show First 20 Lines • Show All 1,752 Lines • ▼ Show 20 Lines | CBlockIndex *ret = nullptr; | ||||
double dProgressTip; | double dProgressTip; | ||||
{ | { | ||||
LOCK(cs_main); | LOCK(cs_main); | ||||
tip = chainActive.Tip(); | tip = chainActive.Tip(); | ||||
dProgressStart = | dProgressStart = | ||||
GuessVerificationProgress(chainParams.TxData(), pindex); | GuessVerificationProgress(chainParams.TxData(), pindex); | ||||
dProgressTip = GuessVerificationProgress(chainParams.TxData(), tip); | dProgressTip = GuessVerificationProgress(chainParams.TxData(), tip); | ||||
} | } | ||||
double gvp = dProgressStart; | |||||
while (pindex && !fAbortRescan) { | while (pindex && !fAbortRescan) { | ||||
if (pindex->nHeight % 100 == 0 && | if (pindex->nHeight % 100 == 0 && | ||||
dProgressTip - dProgressStart > 0.0) { | dProgressTip - dProgressStart > 0.0) { | ||||
double gvp = 0; | |||||
{ | |||||
LOCK(cs_main); | |||||
gvp = | |||||
GuessVerificationProgress(chainParams.TxData(), pindex); | |||||
} | |||||
ShowProgress( | ShowProgress( | ||||
_("Rescanning..."), | _("Rescanning..."), | ||||
std::max( | std::max( | ||||
1, std::min(99, (int)((gvp - dProgressStart) / | 1, std::min(99, (int)((gvp - dProgressStart) / | ||||
(dProgressTip - dProgressStart) * | (dProgressTip - dProgressStart) * | ||||
100)))); | 100)))); | ||||
} | } | ||||
if (GetTime() >= nNow + 60) { | if (GetTime() >= nNow + 60) { | ||||
nNow = GetTime(); | nNow = GetTime(); | ||||
LOCK(cs_main); | LogPrintf("Still rescanning. At block %d. Progress=%f\n", | ||||
LogPrintf( | pindex->nHeight, gvp); | ||||
"Still rescanning. At block %d. Progress=%f\n", | |||||
pindex->nHeight, | |||||
GuessVerificationProgress(chainParams.TxData(), pindex)); | |||||
} | } | ||||
CBlock block; | CBlock block; | ||||
if (ReadBlockFromDisk(block, pindex, GetConfig())) { | if (ReadBlockFromDisk(block, pindex, GetConfig())) { | ||||
LOCK2(cs_main, cs_wallet); | LOCK2(cs_main, cs_wallet); | ||||
if (pindex && !chainActive.Contains(pindex)) { | if (pindex && !chainActive.Contains(pindex)) { | ||||
// Abort scan if current block is no longer active, to | // Abort scan if current block is no longer active, to | ||||
// prevent marking transactions as coming from the wrong | // prevent marking transactions as coming from the wrong | ||||
Show All 10 Lines | CBlockIndex *ret = nullptr; | ||||
ret = pindex; | ret = pindex; | ||||
} | } | ||||
if (pindex == pindexStop) { | if (pindex == pindexStop) { | ||||
break; | break; | ||||
} | } | ||||
{ | { | ||||
LOCK(cs_main); | LOCK(cs_main); | ||||
pindex = chainActive.Next(pindex); | pindex = chainActive.Next(pindex); | ||||
gvp = GuessVerificationProgress(chainParams.TxData(), pindex); | |||||
if (tip != chainActive.Tip()) { | if (tip != chainActive.Tip()) { | ||||
tip = chainActive.Tip(); | tip = chainActive.Tip(); | ||||
// in case the tip has changed, update progress max | // in case the tip has changed, update progress max | ||||
dProgressTip = | dProgressTip = | ||||
GuessVerificationProgress(chainParams.TxData(), tip); | GuessVerificationProgress(chainParams.TxData(), tip); | ||||
} | } | ||||
} | } | ||||
} | } | ||||
if (pindex && fAbortRescan) { | if (pindex && fAbortRescan) { | ||||
LogPrintf("Rescan aborted at block %d. Progress=%f\n", | LogPrintf("Rescan aborted at block %d. Progress=%f\n", | ||||
pindex->nHeight, | pindex->nHeight, gvp); | ||||
GuessVerificationProgress(chainParams.TxData(), pindex)); | |||||
} | } | ||||
// Hide progress dialog in GUI. | // Hide progress dialog in GUI. | ||||
ShowProgress(_("Rescanning..."), 100); | ShowProgress(_("Rescanning..."), 100); | ||||
} | } | ||||
return ret; | return ret; | ||||
} | } | ||||
▲ Show 20 Lines • Show All 2,693 Lines • Show Last 20 Lines |