mirror of
https://github.com/bitcoin/bitcoin.git
synced 2025-12-02 00:38:15 +01:00
Constrain rpcport default values to a single location in code
This commit is contained in:
@@ -86,18 +86,23 @@ const CBaseChainParams& BaseParams()
|
||||
return *pCurrentBaseParams;
|
||||
}
|
||||
|
||||
void SelectBaseParams(const std::string& chain)
|
||||
CBaseChainParams& BaseParams(const std::string& chain)
|
||||
{
|
||||
if (chain == CBaseChainParams::MAIN)
|
||||
pCurrentBaseParams = &mainParams;
|
||||
return mainParams;
|
||||
else if (chain == CBaseChainParams::TESTNET)
|
||||
pCurrentBaseParams = &testNetParams;
|
||||
return testNetParams;
|
||||
else if (chain == CBaseChainParams::REGTEST)
|
||||
pCurrentBaseParams = ®TestParams;
|
||||
return regTestParams;
|
||||
else
|
||||
throw std::runtime_error(strprintf("%s: Unknown chain %s.", __func__, chain));
|
||||
}
|
||||
|
||||
void SelectBaseParams(const std::string& chain)
|
||||
{
|
||||
pCurrentBaseParams = &BaseParams(chain);
|
||||
}
|
||||
|
||||
std::string ChainNameFromCommandLine()
|
||||
{
|
||||
bool fRegTest = GetBoolArg("-regtest", false);
|
||||
|
||||
Reference in New Issue
Block a user