add signet chain and accompanying parameters

Co-authored-by: Anthony Towns <aj@erisian.com.au>
This commit is contained in:
Karl-Johan Alm
2020-03-05 15:58:30 +09:00
parent 404682b7cd
commit e8990f1214
5 changed files with 117 additions and 11 deletions

View File

@@ -263,6 +263,7 @@ const std::list<SectionInfo> ArgsManager::GetUnrecognizedSections() const
// Section names to be recognized in the config file.
static const std::set<std::string> available_sections{
CBaseChainParams::REGTEST,
CBaseChainParams::SIGNET,
CBaseChainParams::TESTNET,
CBaseChainParams::MAIN
};
@@ -916,16 +917,21 @@ std::string ArgsManager::GetChainName() const
};
const bool fRegTest = get_net("-regtest");
const bool fSigNet = get_net("-signet");
const bool fTestNet = get_net("-testnet");
const bool is_chain_arg_set = IsArgSet("-chain");
if ((int)is_chain_arg_set + (int)fRegTest + (int)fTestNet > 1) {
throw std::runtime_error("Invalid combination of -regtest, -testnet and -chain. Can use at most one.");
if ((int)is_chain_arg_set + (int)fRegTest + (int)fSigNet + (int)fTestNet > 1) {
throw std::runtime_error("Invalid combination of -regtest, -signet, -testnet and -chain. Can use at most one.");
}
if (fRegTest)
return CBaseChainParams::REGTEST;
if (fSigNet) {
return CBaseChainParams::SIGNET;
}
if (fTestNet)
return CBaseChainParams::TESTNET;
return GetArg("-chain", CBaseChainParams::MAIN);
}