Changeset View
Changeset View
Standalone View
Standalone View
src/init.cpp
Show First 20 Lines • Show All 1,859 Lines • ▼ Show 20 Lines | #endif | ||||
fCheckpointsEnabled = | fCheckpointsEnabled = | ||||
args.GetBoolArg("-checkpoints", DEFAULT_CHECKPOINTS_ENABLED); | args.GetBoolArg("-checkpoints", DEFAULT_CHECKPOINTS_ENABLED); | ||||
if (fCheckpointsEnabled) { | if (fCheckpointsEnabled) { | ||||
LogPrintf("Checkpoints will be verified.\n"); | LogPrintf("Checkpoints will be verified.\n"); | ||||
} else { | } else { | ||||
LogPrintf("Skipping checkpoint verification.\n"); | LogPrintf("Skipping checkpoint verification.\n"); | ||||
} | } | ||||
if (args.IsArgSet("-minimumchainwork")) { | |||||
const std::string minChainWorkStr = | |||||
args.GetArg("-minimumchainwork", ""); | |||||
if (!IsHexNumber(minChainWorkStr)) { | |||||
return InitError(strprintf( | |||||
Untranslated( | |||||
"Invalid non-hex (%s) minimum chain work value specified"), | |||||
minChainWorkStr)); | |||||
} | |||||
nMinimumChainWork = UintToArith256(uint256S(minChainWorkStr)); | |||||
} else { | |||||
nMinimumChainWork = | |||||
UintToArith256(chainparams.GetConsensus().nMinimumChainWork); | |||||
} | |||||
// Configure excessive block size. | // Configure excessive block size. | ||||
const int64_t nProposedExcessiveBlockSize = | const int64_t nProposedExcessiveBlockSize = | ||||
args.GetIntArg("-excessiveblocksize", DEFAULT_MAX_BLOCK_SIZE); | args.GetIntArg("-excessiveblocksize", DEFAULT_MAX_BLOCK_SIZE); | ||||
if (nProposedExcessiveBlockSize <= 0 || | if (nProposedExcessiveBlockSize <= 0 || | ||||
!config.SetMaxBlockSize(nProposedExcessiveBlockSize)) { | !config.SetMaxBlockSize(nProposedExcessiveBlockSize)) { | ||||
return InitError( | return InitError( | ||||
_("Excessive block size must be > 1,000,000 bytes (1MB)")); | _("Excessive block size must be > 1,000,000 bytes (1MB)")); | ||||
} | } | ||||
▲ Show 20 Lines • Show All 126 Lines • ▼ Show 20 Lines | if (isAvalancheEnabled(args) && args.IsArgSet("-avaproof")) { | ||||
} | } | ||||
if (args.IsArgSet("-onlynet")) { | if (args.IsArgSet("-onlynet")) { | ||||
return InitError( | return InitError( | ||||
_("Restricting the outbound network is not supported when " | _("Restricting the outbound network is not supported when " | ||||
"running a staking node. Please disable -onlynet.")); | "running a staking node. Please disable -onlynet.")); | ||||
} | } | ||||
} | } | ||||
// Also report errors from parsing before daemonization | |||||
{ | |||||
ChainstateManager::Options chainman_opts_dummy{ | |||||
.config = config, | |||||
}; | |||||
if (const auto error{ApplyArgsManOptions(args, chainman_opts_dummy)}) { | |||||
return InitError(*error); | |||||
} | |||||
} | |||||
return true; | return true; | ||||
} | } | ||||
static bool LockDataDirectory(bool probeOnly) { | static bool LockDataDirectory(bool probeOnly) { | ||||
// Make sure only a single Bitcoin process is using the data directory. | // Make sure only a single Bitcoin process is using the data directory. | ||||
fs::path datadir = gArgs.GetDataDirNet(); | fs::path datadir = gArgs.GetDataDirNet(); | ||||
if (!DirIsWritable(datadir)) { | if (!DirIsWritable(datadir)) { | ||||
return InitError(strprintf( | return InitError(strprintf( | ||||
▲ Show 20 Lines • Show All 357 Lines • ▼ Show 20 Lines | #endif | ||||
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{ | ChainstateManager::Options chainman_opts{ | ||||
.config = config, | .config = config, | ||||
.adjusted_time_callback = GetAdjustedTime, | .adjusted_time_callback = GetAdjustedTime, | ||||
}; | }; | ||||
ApplyArgsManOptions(args, chainman_opts); | // no error can happen, already checked in AppInitParameterInteraction | ||||
Assert(!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)); | ||||
▲ Show 20 Lines • Show All 533 Lines • Show Last 20 Lines |