From ae0ff73548d1b5cc8e7f6876040398d089ccd33c Mon Sep 17 00:00:00 2001 From: Duke Date: Mon, 23 Oct 2023 09:49:50 -0400 Subject: [PATCH] Stop building witnesses if shutdown requested, fixes #330 --- src/wallet/wallet.cpp | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/wallet/wallet.cpp b/src/wallet/wallet.cpp index 96d01260d..1acb274df 100644 --- a/src/wallet/wallet.cpp +++ b/src/wallet/wallet.cpp @@ -1146,6 +1146,9 @@ void CWallet::BuildWitnessCache(const CBlockIndex* pindex, bool witnessOnly) LogPrintf("%s: height=%d, startHeight=%d\n", __func__, height, startHeight); while (pblockindex) { + if (ShutdownRequested()) { + break; + } 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() );