mirror of
https://github.com/bitcoin/bitcoin.git
synced 2025-11-11 22:50:59 +01:00
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.
This commit is contained in:
@@ -37,8 +37,8 @@ ChainstateLoadResult LoadChainstate(ChainstateManager& chainman, const CacheSize
|
||||
} else {
|
||||
LogPrintf("Validating signatures for all blocks.\n");
|
||||
}
|
||||
LogPrintf("Setting nMinimumChainWork=%s\n", nMinimumChainWork.GetHex());
|
||||
if (nMinimumChainWork < UintToArith256(chainman.GetConsensus().nMinimumChainWork)) {
|
||||
LogPrintf("Setting nMinimumChainWork=%s\n", chainman.MinimumChainWork().GetHex());
|
||||
if (chainman.MinimumChainWork() < UintToArith256(chainman.GetConsensus().nMinimumChainWork)) {
|
||||
LogPrintf("Warning: nMinimumChainWork set below default value of %s\n", chainman.GetConsensus().nMinimumChainWork.GetHex());
|
||||
}
|
||||
if (nPruneTarget == std::numeric_limits<uint64_t>::max()) {
|
||||
|
||||
@@ -4,16 +4,32 @@
|
||||
|
||||
#include <node/chainstatemanager_args.h>
|
||||
|
||||
#include <arith_uint256.h>
|
||||
#include <tinyformat.h>
|
||||
#include <uint256.h>
|
||||
#include <util/strencodings.h>
|
||||
#include <util/system.h>
|
||||
#include <util/translation.h>
|
||||
#include <validation.h>
|
||||
|
||||
#include <chrono>
|
||||
#include <optional>
|
||||
#include <string>
|
||||
|
||||
namespace node {
|
||||
void ApplyArgsManOptions(const ArgsManager& args, ChainstateManager::Options& opts)
|
||||
std::optional<bilingual_str> ApplyArgsManOptions(const ArgsManager& args, ChainstateManager::Options& opts)
|
||||
{
|
||||
if (auto value{args.GetArg("-minimumchainwork")}) {
|
||||
if (!IsHexNumber(*value)) {
|
||||
return strprintf(Untranslated("Invalid non-hex (%s) minimum chain work value specified"), *value);
|
||||
}
|
||||
opts.minimum_chain_work = UintToArith256(uint256S(*value));
|
||||
}
|
||||
|
||||
if (auto value{args.GetArg("-assumevalid")}) opts.assumed_valid_block = uint256S(*value);
|
||||
|
||||
if (auto value{args.GetIntArg("-maxtipage")}) opts.max_tip_age = std::chrono::seconds{*value};
|
||||
|
||||
return std::nullopt;
|
||||
}
|
||||
} // namespace node
|
||||
|
||||
@@ -7,10 +7,13 @@
|
||||
|
||||
#include <validation.h>
|
||||
|
||||
#include <optional>
|
||||
|
||||
class ArgsManager;
|
||||
struct bilingual_str;
|
||||
|
||||
namespace node {
|
||||
void ApplyArgsManOptions(const ArgsManager& args, ChainstateManager::Options& opts);
|
||||
std::optional<bilingual_str> ApplyArgsManOptions(const ArgsManager& args, ChainstateManager::Options& opts);
|
||||
} // namespace node
|
||||
|
||||
#endif // BITCOIN_NODE_CHAINSTATEMANAGER_ARGS_H
|
||||
|
||||
Reference in New Issue
Block a user