From 4642a35f06ba6e8de0d238d96771a3263ab31a2a Mon Sep 17 00:00:00 2001 From: Duke Date: Mon, 23 Oct 2023 10:47:12 -0400 Subject: [PATCH] Stop building witnesses if abortrescan is called #331 --- src/wallet/wallet.cpp | 6 ++++++ 1 file changed, 6 insertions(+) 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() );