Changeset View
Changeset View
Standalone View
Standalone View
src/init.cpp
Show All 40 Lines | |||||
#include <mempool_args.h> | #include <mempool_args.h> | ||||
#include <net.h> | #include <net.h> | ||||
#include <net_permissions.h> | #include <net_permissions.h> | ||||
#include <net_processing.h> | #include <net_processing.h> | ||||
#include <netbase.h> | #include <netbase.h> | ||||
#include <node/blockstorage.h> | #include <node/blockstorage.h> | ||||
#include <node/caches.h> | #include <node/caches.h> | ||||
#include <node/chainstate.h> | #include <node/chainstate.h> | ||||
#include <node/chainstatemanager_args.h> | |||||
#include <node/context.h> | #include <node/context.h> | ||||
#include <node/mempool_persist_args.h> | #include <node/mempool_persist_args.h> | ||||
#include <node/miner.h> | #include <node/miner.h> | ||||
#include <node/ui_interface.h> | #include <node/ui_interface.h> | ||||
#include <node/validation_cache_args.h> | #include <node/validation_cache_args.h> | ||||
#include <policy/policy.h> | #include <policy/policy.h> | ||||
#include <policy/settings.h> | #include <policy/settings.h> | ||||
#include <rpc/blockchain.h> | #include <rpc/blockchain.h> | ||||
▲ Show 20 Lines • Show All 1,033 Lines • ▼ Show 20 Lines | argsman.AddArg( | ||||
"-maxscriptcachesize=<n>", | "-maxscriptcachesize=<n>", | ||||
strprintf("Limit size of script cache to <n> MiB (default: %u)", | strprintf("Limit size of script cache to <n> MiB (default: %u)", | ||||
DEFAULT_MAX_SCRIPT_CACHE_BYTES >> 20), | DEFAULT_MAX_SCRIPT_CACHE_BYTES >> 20), | ||||
ArgsManager::ALLOW_ANY | ArgsManager::DEBUG_ONLY, | ArgsManager::ALLOW_ANY | ArgsManager::DEBUG_ONLY, | ||||
OptionsCategory::DEBUG_TEST); | OptionsCategory::DEBUG_TEST); | ||||
argsman.AddArg("-maxtipage=<n>", | argsman.AddArg("-maxtipage=<n>", | ||||
strprintf("Maximum tip age in seconds to consider node in " | strprintf("Maximum tip age in seconds to consider node in " | ||||
"initial block download (default: %u)", | "initial block download (default: %u)", | ||||
DEFAULT_MAX_TIP_AGE), | Ticks<std::chrono::seconds>(DEFAULT_MAX_TIP_AGE)), | ||||
ArgsManager::ALLOW_ANY | ArgsManager::DEBUG_ONLY, | ArgsManager::ALLOW_ANY | ArgsManager::DEBUG_ONLY, | ||||
OptionsCategory::DEBUG_TEST); | OptionsCategory::DEBUG_TEST); | ||||
argsman.AddArg("-uacomment=<cmt>", | argsman.AddArg("-uacomment=<cmt>", | ||||
"Append comment to the user agent string", | "Append comment to the user agent string", | ||||
ArgsManager::ALLOW_ANY, OptionsCategory::DEBUG_TEST); | ArgsManager::ALLOW_ANY, OptionsCategory::DEBUG_TEST); | ||||
argsman.AddArg("-uaclientname=<clientname>", "Set user agent client name", | argsman.AddArg("-uaclientname=<clientname>", "Set user agent client name", | ||||
ArgsManager::ALLOW_ANY, OptionsCategory::DEBUG_TEST); | ArgsManager::ALLOW_ANY, OptionsCategory::DEBUG_TEST); | ||||
▲ Show 20 Lines • Show All 853 Lines • ▼ Show 20 Lines | #endif | ||||
// Option to startup with mocktime set (used for regression testing): | // Option to startup with mocktime set (used for regression testing): | ||||
SetMockTime(args.GetIntArg("-mocktime", 0)); // SetMockTime(0) is a no-op | SetMockTime(args.GetIntArg("-mocktime", 0)); // SetMockTime(0) is a no-op | ||||
if (args.GetBoolArg("-peerbloomfilters", DEFAULT_PEERBLOOMFILTERS)) { | if (args.GetBoolArg("-peerbloomfilters", DEFAULT_PEERBLOOMFILTERS)) { | ||||
nLocalServices = ServiceFlags(nLocalServices | NODE_BLOOM); | nLocalServices = ServiceFlags(nLocalServices | NODE_BLOOM); | ||||
} | } | ||||
nMaxTipAge = args.GetIntArg("-maxtipage", DEFAULT_MAX_TIP_AGE); | |||||
if (args.IsArgSet("-proxy") && args.GetArg("-proxy", "").empty()) { | if (args.IsArgSet("-proxy") && args.GetArg("-proxy", "").empty()) { | ||||
return InitError(_( | return InitError(_( | ||||
"No proxy server specified. Use -proxy=<ip> or -proxy=<ip:port>.")); | "No proxy server specified. Use -proxy=<ip> or -proxy=<ip:port>.")); | ||||
} | } | ||||
// Avalanche parameters | // Avalanche parameters | ||||
const int64_t stakeUtxoMinConfirmations = | const int64_t stakeUtxoMinConfirmations = | ||||
args.GetIntArg("-avaproofstakeutxoconfirmations", | args.GetIntArg("-avaproofstakeutxoconfirmations", | ||||
▲ Show 20 Lines • Show All 413 Lines • ▼ Show 20 Lines | #if ENABLE_ZMQ | ||||
} | } | ||||
#endif | #endif | ||||
// Step 7: load block chain | // Step 7: load block chain | ||||
fReindex = args.GetBoolArg("-reindex", false); | fReindex = args.GetBoolArg("-reindex", false); | ||||
bool fReindexChainState = args.GetBoolArg("-reindex-chainstate", false); | bool fReindexChainState = args.GetBoolArg("-reindex-chainstate", false); | ||||
ChainstateManager::Options chainman_opts{ | |||||
.config = config, | |||||
.adjusted_time_callback = GetAdjustedTime, | |||||
}; | |||||
ApplyArgsManOptions(args, chainman_opts); | |||||
// cache size calculations | // cache size calculations | ||||
CacheSizes cache_sizes = | CacheSizes cache_sizes = | ||||
CalculateCacheSizes(args, g_enabled_filter_types.size()); | CalculateCacheSizes(args, g_enabled_filter_types.size()); | ||||
LogPrintf("Cache configuration:\n"); | LogPrintf("Cache configuration:\n"); | ||||
LogPrintf("* Using %.1f MiB for block index database\n", | LogPrintf("* Using %.1f MiB for block index database\n", | ||||
cache_sizes.block_tree_db * (1.0 / 1024 / 1024)); | cache_sizes.block_tree_db * (1.0 / 1024 / 1024)); | ||||
if (args.GetBoolArg("-txindex", DEFAULT_TXINDEX)) { | if (args.GetBoolArg("-txindex", DEFAULT_TXINDEX)) { | ||||
Show All 34 Lines | #endif | ||||
LogPrintf("* Using %.1f MiB for in-memory UTXO set (plus up to %.1f MiB of " | LogPrintf("* Using %.1f MiB for in-memory UTXO set (plus up to %.1f MiB of " | ||||
"unused mempool space)\n", | "unused mempool space)\n", | ||||
cache_sizes.coins * (1.0 / 1024 / 1024), | cache_sizes.coins * (1.0 / 1024 / 1024), | ||||
mempool_opts.max_size_bytes * (1.0 / 1024 / 1024)); | mempool_opts.max_size_bytes * (1.0 / 1024 / 1024)); | ||||
for (bool fLoaded = false; !fLoaded && !ShutdownRequested();) { | for (bool fLoaded = false; !fLoaded && !ShutdownRequested();) { | ||||
node.mempool = std::make_unique<CTxMemPool>(mempool_opts); | node.mempool = std::make_unique<CTxMemPool>(mempool_opts); | ||||
const ChainstateManager::Options chainman_opts{ | |||||
.config = config, | |||||
.adjusted_time_callback = GetAdjustedTime, | |||||
}; | |||||
node.chainman = std::make_unique<ChainstateManager>(chainman_opts); | node.chainman = std::make_unique<ChainstateManager>(chainman_opts); | ||||
ChainstateManager &chainman = *node.chainman; | ChainstateManager &chainman = *node.chainman; | ||||
node::ChainstateLoadOptions options; | node::ChainstateLoadOptions options; | ||||
options.mempool = Assert(node.mempool.get()); | options.mempool = Assert(node.mempool.get()); | ||||
options.reindex = node::fReindex; | options.reindex = node::fReindex; | ||||
options.reindex_chainstate = fReindexChainState; | options.reindex_chainstate = fReindexChainState; | ||||
options.prune = chainman.m_blockman.IsPruneMode(); | options.prune = chainman.m_blockman.IsPruneMode(); | ||||
▲ Show 20 Lines • Show All 482 Lines • Show Last 20 Lines |