Skip to content

Commit 263b23f

Browse files
committed
refactor: Remove call to ShutdownRequested from chainstate init
Use chainman.m_interrupt object instead There is no change in behavior in this commit
1 parent afdc4c3 commit 263b23f

File tree

4 files changed

+3
-5
lines changed

4 files changed

+3
-5
lines changed

src/bitcoin-chainstate.cpp

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -132,7 +132,6 @@ int main(int argc, char* argv[])
132132
cache_sizes.coins_db = 2 << 22;
133133
cache_sizes.coins = (450 << 20) - (2 << 20) - (2 << 22);
134134
node::ChainstateLoadOptions options;
135-
options.check_interrupt = [] { return false; };
136135
auto [status, error] = node::LoadChainstate(chainman, cache_sizes, options);
137136
if (status != node::ChainstateLoadStatus::SUCCESS) {
138137
std::cerr << "Failed to load Chain state from your datadir." << std::endl;

src/init.cpp

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1515,7 +1515,6 @@ bool AppInitMain(NodeContext& node, interfaces::BlockAndHeaderTipInfo* tip_info)
15151515
options.check_blocks = args.GetIntArg("-checkblocks", DEFAULT_CHECKBLOCKS);
15161516
options.check_level = args.GetIntArg("-checklevel", DEFAULT_CHECKLEVEL);
15171517
options.require_full_verification = args.IsArgSet("-checkblocks") || args.IsArgSet("-checklevel");
1518-
options.check_interrupt = ShutdownRequested;
15191518
options.coins_error_cb = [] {
15201519
uiInterface.ThreadSafeMessageBox(
15211520
_("Error reading from database, shutting down."),

src/node/chainstate.cpp

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@
1717
#include <txdb.h>
1818
#include <uint256.h>
1919
#include <util/fs.h>
20+
#include <util/signalinterrupt.h>
2021
#include <util/time.h>
2122
#include <util/translation.h>
2223
#include <validation.h>
@@ -55,14 +56,14 @@ static ChainstateLoadResult CompleteChainstateInitialization(
5556
}
5657
}
5758

58-
if (options.check_interrupt && options.check_interrupt()) return {ChainstateLoadStatus::INTERRUPTED, {}};
59+
if (chainman.m_interrupt) return {ChainstateLoadStatus::INTERRUPTED, {}};
5960

6061
// LoadBlockIndex will load m_have_pruned if we've ever removed a
6162
// block file from disk.
6263
// Note that it also sets fReindex global based on the disk flag!
6364
// From here on, fReindex and options.reindex values may be different!
6465
if (!chainman.LoadBlockIndex()) {
65-
if (options.check_interrupt && options.check_interrupt()) return {ChainstateLoadStatus::INTERRUPTED, {}};
66+
if (chainman.m_interrupt) return {ChainstateLoadStatus::INTERRUPTED, {}};
6667
return {ChainstateLoadStatus::FAILURE, _("Error loading block database")};
6768
}
6869

src/node/chainstate.h

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,6 @@ struct ChainstateLoadOptions {
3232
bool require_full_verification{true};
3333
int64_t check_blocks{DEFAULT_CHECKBLOCKS};
3434
int64_t check_level{DEFAULT_CHECKLEVEL};
35-
std::function<bool()> check_interrupt;
3635
std::function<void()> coins_error_cb;
3736
};
3837

0 commit comments

Comments
 (0)