diff --git a/src/wallet/wallet.cpp b/src/wallet/wallet.cpp index 1acb274df..43f4b5b2a 100644 --- a/src/wallet/wallet.cpp +++ b/src/wallet/wallet.cpp @@ -1147,8 +1147,14 @@ void CWallet::BuildWitnessCache(const CBlockIndex* pindex, bool witnessOnly) while (pblockindex) { if (ShutdownRequested()) { + LogPrintf("%s: shutdown requested, aborting building witnesses\n", __func__); break; } + if(pwalletMain->fAbortRescan) { + LogPrintf("%s: rescan aborted at block %d, stopping witness building\n", pwalletMain->rescanHeight); + pwalletMain->fRescanning = false; + return; + } if (pblockindex->GetHeight() % 100 == 0 && pblockindex->GetHeight() < height - 5) { LogPrintf("Building Witnesses for block %i %.4f complete, %d remaining\n", pblockindex->GetHeight(), pblockindex->GetHeight() / double(height), height - pblockindex->GetHeight() );