Move ChainNameFromCommandLine into ArgsManager and rename to GetChainName

This commit is contained in:
Anthony Towns
2018-03-29 15:00:00 +10:00
parent 5f0c6a7b0e
commit 11b6b5b86e
9 changed files with 27 additions and 27 deletions

View File

@@ -764,6 +764,20 @@ void ArgsManager::ReadConfigFile(const std::string& confPath)
}
}
std::string ArgsManager::GetChainName() const
{
bool fRegTest = GetBoolArg("-regtest", false);
bool fTestNet = GetBoolArg("-testnet", false);
if (fTestNet && fRegTest)
throw std::runtime_error("Invalid combination of -regtest and -testnet.");
if (fRegTest)
return CBaseChainParams::REGTEST;
if (fTestNet)
return CBaseChainParams::TESTNET;
return CBaseChainParams::MAIN;
}
#ifndef WIN32
fs::path GetPidFile()
{