aboutsummaryrefslogtreecommitdiff
path: root/src/init.cpp
diff options
context:
space:
mode:
authorMacroFake <falke.marco@gmail.com>2022-07-21 11:13:13 +0200
committerMacroFake <falke.marco@gmail.com>2022-10-18 14:09:17 +0200
commitcccca83099453bf0882bce4f897f77eee5836e8b (patch)
treee11464bfbff9e455af8f556c43d1c42ff8178546 /src/init.cpp
parentfa29d0b57cdeb91c8798d5c90ba9cc18085e99fb (diff)
downloadbitcoin-cccca83099453bf0882bce4f897f77eee5836e8b.tar.xz
Move ::nMinimumChainWork into ChainstateManager
This changes the minimum chain work for the bitcoin-chainstate executable. Previously it was uint256{}, now it is the chain's default minimum chain work.
Diffstat (limited to 'src/init.cpp')
-rw-r--r--src/init.cpp22
1 files changed, 11 insertions, 11 deletions
diff --git a/src/init.cpp b/src/init.cpp
index b99f16d85e..0c368d8bac 100644
--- a/src/init.cpp
+++ b/src/init.cpp
@@ -937,16 +937,6 @@ bool AppInitParameterInteraction(const ArgsManager& args, bool use_syscall_sandb
fCheckBlockIndex = args.GetBoolArg("-checkblockindex", chainparams.DefaultConsistencyChecks());
fCheckpointsEnabled = args.GetBoolArg("-checkpoints", DEFAULT_CHECKPOINTS_ENABLED);
- 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);
- }
-
// block pruning; get the amount of disk space (in MiB) to allot for block & undo files
int64_t nPruneArg = args.GetIntArg("-prune", 0);
if (nPruneArg < 0) {
@@ -1044,6 +1034,16 @@ bool AppInitParameterInteraction(const ArgsManager& args, bool use_syscall_sandb
}
#endif // USE_SYSCALL_SANDBOX
+ // Also report errors from parsing before daemonization
+ {
+ ChainstateManager::Options chainman_opts_dummy{
+ .chainparams = chainparams,
+ };
+ if (const auto error{ApplyArgsManOptions(args, chainman_opts_dummy)}) {
+ return InitError(*error);
+ }
+ }
+
return true;
}
@@ -1439,7 +1439,7 @@ bool AppInitMain(NodeContext& node, interfaces::BlockAndHeaderTipInfo* tip_info)
.chainparams = chainparams,
.adjusted_time_callback = GetAdjustedTime,
};
- ApplyArgsManOptions(args, chainman_opts);
+ Assert(!ApplyArgsManOptions(args, chainman_opts)); // no error can happen, already checked in AppInitParameterInteraction
// cache size calculations
CacheSizes cache_sizes = CalculateCacheSizes(args, g_enabled_filter_types.size());