mirror of
https://github.com/bitcoin/bitcoin.git
synced 2025-11-10 22:18:54 +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:
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user