Decouple RegTestChainParams from ArgsManager

RegTest chain params can now be initialized by configuring a
RegTestOptions struct, or with ArgsManager. This offers an interface for
creating RegTestChainParams without a gArgs object.
This commit is contained in:
Carl Dong
2022-03-09 16:11:39 -05:00
committed by TheCharlatan
parent 76cd4e7c96
commit 84b85786f0
4 changed files with 89 additions and 30 deletions

View File

@@ -6,6 +6,8 @@
#include <consensus/params.h>
#include <string_view>
const struct VBDeploymentInfo VersionBitsDeploymentInfo[Consensus::MAX_VERSION_BITS_DEPLOYMENTS] = {
{
/*.name =*/ "testdummy",
@@ -34,3 +36,19 @@ std::string DeploymentName(Consensus::BuriedDeployment dep)
} // no default case, so the compiler can warn about missing cases
return "";
}
std::optional<Consensus::BuriedDeployment> GetBuriedDeployment(const std::string_view name)
{
if (name == "segwit") {
return Consensus::BuriedDeployment::DEPLOYMENT_SEGWIT;
} else if (name == "bip34") {
return Consensus::BuriedDeployment::DEPLOYMENT_HEIGHTINCB;
} else if (name == "dersig") {
return Consensus::BuriedDeployment::DEPLOYMENT_DERSIG;
} else if (name == "cltv") {
return Consensus::BuriedDeployment::DEPLOYMENT_CLTV;
} else if (name == "csv") {
return Consensus::BuriedDeployment::DEPLOYMENT_CSV;
}
return std::nullopt;
}