wallet: Interrupt rescan on shutdown request
This commit is contained in:
parent
0bc980b1f6
commit
c4fda7672a
1 changed files with 4 additions and 1 deletions
|
@ -11,6 +11,7 @@
|
||||||
#include <consensus/consensus.h>
|
#include <consensus/consensus.h>
|
||||||
#include <consensus/validation.h>
|
#include <consensus/validation.h>
|
||||||
#include <fs.h>
|
#include <fs.h>
|
||||||
|
#include <init.h>
|
||||||
#include <key.h>
|
#include <key.h>
|
||||||
#include <key_io.h>
|
#include <key_io.h>
|
||||||
#include <keystore.h>
|
#include <keystore.h>
|
||||||
|
@ -1753,7 +1754,7 @@ CBlockIndex* CWallet::ScanForWalletTransactions(CBlockIndex* pindexStart, CBlock
|
||||||
dProgressTip = GuessVerificationProgress(chainParams.TxData(), tip);
|
dProgressTip = GuessVerificationProgress(chainParams.TxData(), tip);
|
||||||
}
|
}
|
||||||
double gvp = dProgressStart;
|
double gvp = dProgressStart;
|
||||||
while (pindex && !fAbortRescan)
|
while (pindex && !fAbortRescan && !ShutdownRequested())
|
||||||
{
|
{
|
||||||
if (pindex->nHeight % 100 == 0 && dProgressTip - dProgressStart > 0.0) {
|
if (pindex->nHeight % 100 == 0 && dProgressTip - dProgressStart > 0.0) {
|
||||||
ShowProgress(_("Rescanning..."), std::max(1, std::min(99, (int)((gvp - dProgressStart) / (dProgressTip - dProgressStart) * 100))));
|
ShowProgress(_("Rescanning..."), std::max(1, std::min(99, (int)((gvp - dProgressStart) / (dProgressTip - dProgressStart) * 100))));
|
||||||
|
@ -1794,6 +1795,8 @@ CBlockIndex* CWallet::ScanForWalletTransactions(CBlockIndex* pindexStart, CBlock
|
||||||
}
|
}
|
||||||
if (pindex && fAbortRescan) {
|
if (pindex && fAbortRescan) {
|
||||||
LogPrintf("Rescan aborted at block %d. Progress=%f\n", pindex->nHeight, gvp);
|
LogPrintf("Rescan aborted at block %d. Progress=%f\n", pindex->nHeight, gvp);
|
||||||
|
} else if (pindex && ShutdownRequested()) {
|
||||||
|
LogPrintf("Rescan interrupted by shutdown request at block %d. Progress=%f\n", pindex->nHeight, gvp);
|
||||||
}
|
}
|
||||||
ShowProgress(_("Rescanning..."), 100); // hide progress dialog in GUI
|
ShowProgress(_("Rescanning..."), 100); // hide progress dialog in GUI
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue