mirror of
https://github.com/bitcoin/bitcoin.git
synced 2025-04-29 23:09:44 -04:00
refactor: Remove call to ShutdownRequested from chainstate init
Use chainman.m_interrupt object instead There is no change in behavior in this commit
This commit is contained in:
parent
afdc4c3a30
commit
263b23f008
4 changed files with 3 additions and 5 deletions
|
@ -132,7 +132,6 @@ int main(int argc, char* argv[])
|
||||||
cache_sizes.coins_db = 2 << 22;
|
cache_sizes.coins_db = 2 << 22;
|
||||||
cache_sizes.coins = (450 << 20) - (2 << 20) - (2 << 22);
|
cache_sizes.coins = (450 << 20) - (2 << 20) - (2 << 22);
|
||||||
node::ChainstateLoadOptions options;
|
node::ChainstateLoadOptions options;
|
||||||
options.check_interrupt = [] { return false; };
|
|
||||||
auto [status, error] = node::LoadChainstate(chainman, cache_sizes, options);
|
auto [status, error] = node::LoadChainstate(chainman, cache_sizes, options);
|
||||||
if (status != node::ChainstateLoadStatus::SUCCESS) {
|
if (status != node::ChainstateLoadStatus::SUCCESS) {
|
||||||
std::cerr << "Failed to load Chain state from your datadir." << std::endl;
|
std::cerr << "Failed to load Chain state from your datadir." << std::endl;
|
||||||
|
|
|
@ -1515,7 +1515,6 @@ bool AppInitMain(NodeContext& node, interfaces::BlockAndHeaderTipInfo* tip_info)
|
||||||
options.check_blocks = args.GetIntArg("-checkblocks", DEFAULT_CHECKBLOCKS);
|
options.check_blocks = args.GetIntArg("-checkblocks", DEFAULT_CHECKBLOCKS);
|
||||||
options.check_level = args.GetIntArg("-checklevel", DEFAULT_CHECKLEVEL);
|
options.check_level = args.GetIntArg("-checklevel", DEFAULT_CHECKLEVEL);
|
||||||
options.require_full_verification = args.IsArgSet("-checkblocks") || args.IsArgSet("-checklevel");
|
options.require_full_verification = args.IsArgSet("-checkblocks") || args.IsArgSet("-checklevel");
|
||||||
options.check_interrupt = ShutdownRequested;
|
|
||||||
options.coins_error_cb = [] {
|
options.coins_error_cb = [] {
|
||||||
uiInterface.ThreadSafeMessageBox(
|
uiInterface.ThreadSafeMessageBox(
|
||||||
_("Error reading from database, shutting down."),
|
_("Error reading from database, shutting down."),
|
||||||
|
|
|
@ -17,6 +17,7 @@
|
||||||
#include <txdb.h>
|
#include <txdb.h>
|
||||||
#include <uint256.h>
|
#include <uint256.h>
|
||||||
#include <util/fs.h>
|
#include <util/fs.h>
|
||||||
|
#include <util/signalinterrupt.h>
|
||||||
#include <util/time.h>
|
#include <util/time.h>
|
||||||
#include <util/translation.h>
|
#include <util/translation.h>
|
||||||
#include <validation.h>
|
#include <validation.h>
|
||||||
|
@ -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
|
// LoadBlockIndex will load m_have_pruned if we've ever removed a
|
||||||
// block file from disk.
|
// block file from disk.
|
||||||
// Note that it also sets fReindex global based on the disk flag!
|
// Note that it also sets fReindex global based on the disk flag!
|
||||||
// From here on, fReindex and options.reindex values may be different!
|
// From here on, fReindex and options.reindex values may be different!
|
||||||
if (!chainman.LoadBlockIndex()) {
|
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")};
|
return {ChainstateLoadStatus::FAILURE, _("Error loading block database")};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -32,7 +32,6 @@ struct ChainstateLoadOptions {
|
||||||
bool require_full_verification{true};
|
bool require_full_verification{true};
|
||||||
int64_t check_blocks{DEFAULT_CHECKBLOCKS};
|
int64_t check_blocks{DEFAULT_CHECKBLOCKS};
|
||||||
int64_t check_level{DEFAULT_CHECKLEVEL};
|
int64_t check_level{DEFAULT_CHECKLEVEL};
|
||||||
std::function<bool()> check_interrupt;
|
|
||||||
std::function<void()> coins_error_cb;
|
std::function<void()> coins_error_cb;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
Loading…
Add table
Reference in a new issue