mirror of
https://github.com/bitcoin/bitcoin.git
synced 2025-11-12 15:09:59 +01:00
refactor, validation: Add ChainstateManagerOpts db options
Use ChainstateManagerOpts struct to remove ArgsManager uses from validation.cpp. This commit does not change behavior.
This commit is contained in:
@@ -10,14 +10,12 @@
|
||||
#include <consensus/params.h>
|
||||
#include <logging.h>
|
||||
#include <node/blockstorage.h>
|
||||
#include <node/database_args.h>
|
||||
#include <node/caches.h>
|
||||
#include <sync.h>
|
||||
#include <threadsafety.h>
|
||||
#include <tinyformat.h>
|
||||
#include <txdb.h>
|
||||
#include <uint256.h>
|
||||
#include <util/system.h>
|
||||
#include <util/time.h>
|
||||
#include <util/translation.h>
|
||||
#include <validation.h>
|
||||
@@ -67,11 +65,11 @@ ChainstateLoadResult LoadChainstate(ChainstateManager& chainman, const CacheSize
|
||||
// fails if it's still open from the previous loop. Close it first:
|
||||
pblocktree.reset();
|
||||
pblocktree = std::make_unique<CBlockTreeDB>(DBParams{
|
||||
.path = gArgs.GetDataDirNet() / "blocks" / "index",
|
||||
.path = chainman.m_options.datadir / "blocks" / "index",
|
||||
.cache_bytes = static_cast<size_t>(cache_sizes.block_tree_db),
|
||||
.memory_only = options.block_tree_db_in_memory,
|
||||
.wipe_data = options.reindex,
|
||||
.options = [] { DBOptions options; node::ReadDatabaseArgs(gArgs, options); return options; }()});
|
||||
.options = chainman.m_options.block_tree_db});
|
||||
|
||||
if (options.reindex) {
|
||||
pblocktree->WriteReindexing(true);
|
||||
|
||||
@@ -5,6 +5,9 @@
|
||||
#include <node/chainstatemanager_args.h>
|
||||
|
||||
#include <arith_uint256.h>
|
||||
#include <kernel/chainstatemanager_opts.h>
|
||||
#include <node/coins_view_args.h>
|
||||
#include <node/database_args.h>
|
||||
#include <tinyformat.h>
|
||||
#include <uint256.h>
|
||||
#include <util/strencodings.h>
|
||||
@@ -34,6 +37,10 @@ std::optional<bilingual_str> ApplyArgsManOptions(const ArgsManager& args, Chains
|
||||
|
||||
if (auto value{args.GetIntArg("-maxtipage")}) opts.max_tip_age = std::chrono::seconds{*value};
|
||||
|
||||
ReadDatabaseArgs(args, opts.block_tree_db);
|
||||
ReadDatabaseArgs(args, opts.coins_db);
|
||||
ReadCoinsViewArgs(args, opts.coins_view);
|
||||
|
||||
return std::nullopt;
|
||||
}
|
||||
} // namespace node
|
||||
|
||||
Reference in New Issue
Block a user