aboutsummaryrefslogtreecommitdiff
path: root/src/wallet.cpp
diff options
context:
space:
mode:
authorWladimir J. van der Laan <laanwj@gmail.com>2014-04-03 11:50:29 +0200
committerWladimir J. van der Laan <laanwj@gmail.com>2014-04-03 11:51:02 +0200
commit9bd1bdd08cd4e90f5004c40f2f3cee0f250b0811 (patch)
treea650058b6950caf5d67dc468964b6eeeb158dc0c /src/wallet.cpp
parent8556b0298d6b7101b063862fb4ab6b4a67dd2361 (diff)
parent392783697c21a0c4cf3db6b0946d3d44d7fed537 (diff)
Merge pull request #3928
3927836 [Qt] rescan progress (Cozz Lovan)
Diffstat (limited to 'src/wallet.cpp')
-rw-r--r--src/wallet.cpp20
1 files changed, 14 insertions, 6 deletions
diff --git a/src/wallet.cpp b/src/wallet.cpp
index df1eb549ad..775eb8f580 100644
--- a/src/wallet.cpp
+++ b/src/wallet.cpp
@@ -835,14 +835,19 @@ int CWallet::ScanForWalletTransactions(CBlockIndex* pindexStart, bool fUpdate)
CBlockIndex* pindex = pindexStart;
{
LOCK(cs_wallet);
+
+ // no need to read and scan block, if block was created before
+ // our wallet birthday (as adjusted for block time variability)
+ while (pindex && nTimeFirstKey && (pindex->nTime < (nTimeFirstKey - 7200)))
+ pindex = chainActive.Next(pindex);
+
+ ShowProgress(_("Rescanning..."), 0); // show rescan progress in GUI as dialog or on splashscreen, if -rescan on startup
+ double dProgressStart = Checkpoints::GuessVerificationProgress(pindex, false);
+ double dProgressTip = Checkpoints::GuessVerificationProgress(chainActive.Tip(), false);
while (pindex)
{
- // no need to read and scan block, if block was created before
- // our wallet birthday (as adjusted for block time variability)
- if (nTimeFirstKey && (pindex->nTime < (nTimeFirstKey - 7200))) {
- pindex = chainActive.Next(pindex);
- continue;
- }
+ if (pindex->nHeight % 100 == 0 && dProgressTip - dProgressStart > 0.0)
+ ShowProgress(_("Rescanning..."), std::max(1, std::min(99, (int)((Checkpoints::GuessVerificationProgress(pindex, false) - dProgressStart) / (dProgressTip - dProgressStart) * 100))));
CBlock block;
ReadBlockFromDisk(block, pindex);
@@ -857,6 +862,7 @@ int CWallet::ScanForWalletTransactions(CBlockIndex* pindexStart, bool fUpdate)
LogPrintf("Still rescanning. At block %d. Progress=%f\n", pindex->nHeight, Checkpoints::GuessVerificationProgress(pindex));
}
}
+ ShowProgress(_("Rescanning..."), 100); // hide progress dialog in GUI
}
return ret;
}
@@ -1492,6 +1498,8 @@ DBErrors CWallet::LoadWallet(bool& fFirstRunRet)
return nLoadWalletRet;
fFirstRunRet = !vchDefaultKey.IsValid();
+ uiInterface.LoadWallet(this);
+
return DB_LOAD_OK;
}