mirror of
https://github.com/dashpay/dash.git
synced 2024-12-25 20:12:57 +01:00
ArgsManager: special handling for -regtest and -testnet
This commit is contained in:
parent
608415d4e6
commit
005ad26649
20
src/util.cpp
20
src/util.cpp
@ -537,6 +537,22 @@ public:
|
||||
|
||||
return found_result;
|
||||
}
|
||||
|
||||
/* Special test for -testnet and -regtest args, because we
|
||||
* don't want to be confused by craziness like "[regtest] testnet=1"
|
||||
*/
|
||||
static inline bool GetNetBoolArg(const ArgsManager &am, const std::string& net_arg)
|
||||
{
|
||||
std::pair<bool,std::string> found_result(false,std::string());
|
||||
found_result = GetArgHelper(am.m_override_args, net_arg, true);
|
||||
if (!found_result.first) {
|
||||
found_result = GetArgHelper(am.m_config_args, net_arg, true);
|
||||
if (!found_result.first) {
|
||||
return false; // not set
|
||||
}
|
||||
}
|
||||
return InterpretBool(found_result.second); // is set, so evaluate
|
||||
}
|
||||
};
|
||||
|
||||
/**
|
||||
@ -950,8 +966,8 @@ void ArgsManager::ReadConfigFile(const std::string& confPath)
|
||||
|
||||
std::string ArgsManager::GetChainName() const
|
||||
{
|
||||
bool fRegTest = GetBoolArg("-regtest", false);
|
||||
bool fTestNet = GetBoolArg("-testnet", false);
|
||||
bool fRegTest = ArgsManagerHelper::GetNetBoolArg(*this, "-regtest");
|
||||
bool fTestNet = ArgsManagerHelper::GetNetBoolArg(*this, "-testnet");
|
||||
|
||||
if (fTestNet && fRegTest)
|
||||
throw std::runtime_error("Invalid combination of -regtest and -testnet.");
|
||||
|
Loading…
Reference in New Issue
Block a user