32 const auto signet_challenge =
args.
GetArgs(
"-signetchallenge");
33 if (signet_challenge.size() != 1) {
34 throw std::runtime_error(
"-signetchallenge cannot be multiple values.");
38 throw std::runtime_error(
strprintf(
"-signetchallenge must be hex, not '%s'.", signet_challenge[0]));
49 for (
const std::string&
arg :
args.
GetArgs(
"-testactivationheight")) {
50 const auto found{
arg.find(
'@')};
51 if (found == std::string::npos) {
52 throw std::runtime_error(
strprintf(
"Invalid format (%s) for -testactivationheight=name@height.",
arg));
55 const auto value{
arg.substr(found + 1)};
58 throw std::runtime_error(
strprintf(
"Invalid height value (%s) for -testactivationheight=name@height.",
arg));
65 throw std::runtime_error(
strprintf(
"Invalid name (%s) for -testactivationheight=name@height.",
arg));
72 throw std::runtime_error(
"Version bits parameters malformed, expecting deployment:start:end[:min_activation_height]");
87 if (!min_activation_height) {
90 vbparams.min_activation_height = *min_activation_height;
99 LogInfo(
"Setting version bits activation parameters for %s to start=%ld, timeout=%ld, min_activation_height=%d",
bool HasTestOption(const ArgsManager &args, const std::string &test_option)
Checks if a particular test option is present in -test command-line arg options.
std::unique_ptr< const CChainParams > CreateChainParams(const ArgsManager &args, const ChainType chain)
Creates and returns a std::unique_ptr<CChainParams> of the chosen chain.
static std::unique_ptr< const CChainParams > globalChainParams
void SelectParams(const ChainType chain)
Sets the params returned by Params() to those for the given chain type.
const CChainParams & Params()
Return the currently selected parameters.
void ReadSigNetArgs(const ArgsManager &args, CChainParams::SigNetOptions &options)
void ReadRegTestArgs(const ArgsManager &args, CChainParams::RegTestOptions &options)
void SelectBaseParams(const ChainType chain)
Sets the params returned by Params() to those for the given chain.
std::vector< std::string > GetArgs(const std::string &strArg) const
Return a vector of strings of the given argument.
bool GetBoolArg(const std::string &strArg, bool fDefault) const
Return boolean argument or default value.
CChainParams defines various tweakable parameters of a given instance of the Bitcoin system.
static std::unique_ptr< const CChainParams > Main()
static std::unique_ptr< const CChainParams > RegTest(const RegTestOptions &options)
static std::unique_ptr< const CChainParams > TestNet()
static std::unique_ptr< const CChainParams > TestNet4()
static std::unique_ptr< const CChainParams > SigNet(const SigNetOptions &options)
std::optional< Consensus::BuriedDeployment > GetBuriedDeployment(const std::string_view name)
const std::array< VBDeploymentInfo, Consensus::MAX_VERSION_BITS_DEPLOYMENTS > VersionBitsDeploymentInfo
@ MAX_VERSION_BITS_DEPLOYMENTS
std::vector< std::string > SplitString(std::string_view str, char sep)
RegTestOptions holds configurations for creating a regtest CChainParams.
std::unordered_map< Consensus::DeploymentPos, VersionBitsParameters > version_bits_parameters
std::unordered_map< Consensus::BuriedDeployment, int > activation_heights
SigNetOptions holds configurations for creating a signet CChainParams.
std::optional< std::vector< uint8_t > > challenge
std::optional< std::vector< std::string > > seeds
VersionBitsParameters holds activation parameters.
constexpr auto Ticks(Dur2 d)
Helper to count the seconds of a duration/time_point.