6
6
7
7
#include < chainparams.h> // for CChainParams
8
8
#include < node/blockstorage.h> // for CleanupBlockRevFiles, fHavePruned, fReindex
9
- #include < shutdown.h> // for ShutdownRequested
10
9
#include < validation.h> // for a lot of things
11
10
12
11
std::optional<ChainstateLoadingError> LoadChainstate (bool fReset ,
@@ -18,6 +17,7 @@ std::optional<ChainstateLoadingError> LoadChainstate(bool fReset,
18
17
int64_t nBlockTreeDBCache,
19
18
int64_t nCoinDBCache,
20
19
int64_t nCoinCacheUsage,
20
+ std::function<bool ()> shutdown_requested,
21
21
std::function<void()> coins_error_cb)
22
22
{
23
23
auto is_coinsview_empty = [&](CChainState* chainstate) EXCLUSIVE_LOCKS_REQUIRED (::cs_main) {
@@ -45,14 +45,14 @@ std::optional<ChainstateLoadingError> LoadChainstate(bool fReset,
45
45
CleanupBlockRevFiles ();
46
46
}
47
47
48
- if (ShutdownRequested ()) return ChainstateLoadingError::SHUTDOWN_PROBED;
48
+ if (shutdown_requested && shutdown_requested ()) return ChainstateLoadingError::SHUTDOWN_PROBED;
49
49
50
50
// LoadBlockIndex will load fHavePruned if we've ever removed a
51
51
// block file from disk.
52
52
// Note that it also sets fReindex based on the disk flag!
53
53
// From here on out fReindex and fReset mean something different!
54
54
if (!chainman.LoadBlockIndex ()) {
55
- if (ShutdownRequested ()) return ChainstateLoadingError::SHUTDOWN_PROBED;
55
+ if (shutdown_requested && shutdown_requested ()) return ChainstateLoadingError::SHUTDOWN_PROBED;
56
56
return ChainstateLoadingError::ERROR_LOADING_BLOCK_DB;
57
57
}
58
58
0 commit comments