mirror of
https://github.com/bitcoin/bitcoin.git
synced 2025-11-13 07:28:59 +01:00
Testchains: Generic selection with -chain=<str> in addition of -testnet and -regtest
This commit is contained in:
@@ -954,16 +954,18 @@ bool ArgsManager::ReadConfigFiles(std::string& error, bool ignore_invalid_keys)
|
||||
std::string ArgsManager::GetChainName() const
|
||||
{
|
||||
LOCK(cs_args);
|
||||
bool fRegTest = ArgsManagerHelper::GetNetBoolArg(*this, "-regtest");
|
||||
bool fTestNet = ArgsManagerHelper::GetNetBoolArg(*this, "-testnet");
|
||||
const bool fRegTest = ArgsManagerHelper::GetNetBoolArg(*this, "-regtest");
|
||||
const bool fTestNet = ArgsManagerHelper::GetNetBoolArg(*this, "-testnet");
|
||||
const bool is_chain_arg_set = IsArgSet("-chain");
|
||||
|
||||
if (fTestNet && fRegTest)
|
||||
throw std::runtime_error("Invalid combination of -regtest and -testnet.");
|
||||
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 (fRegTest)
|
||||
return CBaseChainParams::REGTEST;
|
||||
if (fTestNet)
|
||||
return CBaseChainParams::TESTNET;
|
||||
return CBaseChainParams::MAIN;
|
||||
return GetArg("-chain", CBaseChainParams::MAIN);
|
||||
}
|
||||
|
||||
bool RenameOver(fs::path src, fs::path dest)
|
||||
|
||||
Reference in New Issue
Block a user