From 263b23f0082c60516acced1b03abb8e4d8f9ee46 Mon Sep 17 00:00:00 2001 From: Ryan Ofsky Date: Fri, 7 Jul 2023 17:32:54 -0400 Subject: refactor: Remove call to ShutdownRequested from chainstate init Use chainman.m_interrupt object instead There is no change in behavior in this commit --- src/bitcoin-chainstate.cpp | 1 - src/init.cpp | 1 - src/node/chainstate.cpp | 5 +++-- src/node/chainstate.h | 1 - 4 files changed, 3 insertions(+), 5 deletions(-) diff --git a/src/bitcoin-chainstate.cpp b/src/bitcoin-chainstate.cpp index 31edb86ce2..f241bdae4d 100644 --- a/src/bitcoin-chainstate.cpp +++ b/src/bitcoin-chainstate.cpp @@ -132,7 +132,6 @@ int main(int argc, char* argv[]) cache_sizes.coins_db = 2 << 22; cache_sizes.coins = (450 << 20) - (2 << 20) - (2 << 22); node::ChainstateLoadOptions options; - options.check_interrupt = [] { return false; }; auto [status, error] = node::LoadChainstate(chainman, cache_sizes, options); if (status != node::ChainstateLoadStatus::SUCCESS) { std::cerr << "Failed to load Chain state from your datadir." << std::endl; diff --git a/src/init.cpp b/src/init.cpp index ac52b34fc5..8bff75ec91 100644 --- a/src/init.cpp +++ b/src/init.cpp @@ -1515,7 +1515,6 @@ bool AppInitMain(NodeContext& node, interfaces::BlockAndHeaderTipInfo* tip_info) options.check_blocks = args.GetIntArg("-checkblocks", DEFAULT_CHECKBLOCKS); options.check_level = args.GetIntArg("-checklevel", DEFAULT_CHECKLEVEL); options.require_full_verification = args.IsArgSet("-checkblocks") || args.IsArgSet("-checklevel"); - options.check_interrupt = ShutdownRequested; options.coins_error_cb = [] { uiInterface.ThreadSafeMessageBox( _("Error reading from database, shutting down."), diff --git a/src/node/chainstate.cpp b/src/node/chainstate.cpp index eb1994177a..bf1fc06b0b 100644 --- a/src/node/chainstate.cpp +++ b/src/node/chainstate.cpp @@ -17,6 +17,7 @@ #include #include #include +#include #include #include #include @@ -55,14 +56,14 @@ static ChainstateLoadResult CompleteChainstateInitialization( } } - if (options.check_interrupt && options.check_interrupt()) return {ChainstateLoadStatus::INTERRUPTED, {}}; + if (chainman.m_interrupt) return {ChainstateLoadStatus::INTERRUPTED, {}}; // LoadBlockIndex will load m_have_pruned if we've ever removed a // block file from disk. // Note that it also sets fReindex global based on the disk flag! // From here on, fReindex and options.reindex values may be different! if (!chainman.LoadBlockIndex()) { - if (options.check_interrupt && options.check_interrupt()) return {ChainstateLoadStatus::INTERRUPTED, {}}; + if (chainman.m_interrupt) return {ChainstateLoadStatus::INTERRUPTED, {}}; return {ChainstateLoadStatus::FAILURE, _("Error loading block database")}; } diff --git a/src/node/chainstate.h b/src/node/chainstate.h index 2e35035c28..a6e9a0331b 100644 --- a/src/node/chainstate.h +++ b/src/node/chainstate.h @@ -32,7 +32,6 @@ struct ChainstateLoadOptions { bool require_full_verification{true}; int64_t check_blocks{DEFAULT_CHECKBLOCKS}; int64_t check_level{DEFAULT_CHECKLEVEL}; - std::function check_interrupt; std::function coins_error_cb; }; -- cgit v1.2.3 From f0c73c1336bee74fe2d58474ac36bca28c219e85 Mon Sep 17 00:00:00 2001 From: Ryan Ofsky Date: Fri, 7 Jul 2023 17:32:54 -0400 Subject: refactor: Remove call to ShutdownRequested from rpc/mining Use chainman.m_interrupt object instead There is no change in behavior in this commit --- src/rpc/mining.cpp | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/src/rpc/mining.cpp b/src/rpc/mining.cpp index 3d80656507..15a7792c36 100644 --- a/src/rpc/mining.cpp +++ b/src/rpc/mining.cpp @@ -27,7 +27,6 @@ #include