mirror of
https://github.com/bitcoin/bitcoin.git
synced 2025-11-26 05:48:20 +01:00
Chainparams: Translations: DRY: options and error strings
Also remove SelectBaseParamsFromCommandLine and SelectParamsFromCommandLine
This commit is contained in:
@@ -13,7 +13,16 @@
|
||||
const std::string CBaseChainParams::MAIN = "main";
|
||||
const std::string CBaseChainParams::TESTNET = "test";
|
||||
const std::string CBaseChainParams::REGTEST = "regtest";
|
||||
const std::string CBaseChainParams::MAX_NETWORK_TYPES = "unknown_chain";
|
||||
|
||||
void AppendParamsHelpMessages(std::string& strUsage, bool debugHelp)
|
||||
{
|
||||
strUsage += HelpMessageGroup(_("Chain selection options:"));
|
||||
strUsage += HelpMessageOpt("-testnet", _("Use the test chain"));
|
||||
if (debugHelp) {
|
||||
strUsage += HelpMessageOpt("-regtest", "Enter regression test mode, which uses a special chain in which blocks can be solved instantly. "
|
||||
"This is intended for regression testing tools and app development.");
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Main network
|
||||
@@ -95,7 +104,7 @@ std::string ChainNameFromCommandLine()
|
||||
bool fTestNet = GetBoolArg("-testnet", false);
|
||||
|
||||
if (fTestNet && fRegTest)
|
||||
return CBaseChainParams::MAX_NETWORK_TYPES;
|
||||
throw std::runtime_error("Invalid combination of -regtest and -testnet.");
|
||||
if (fRegTest)
|
||||
return CBaseChainParams::REGTEST;
|
||||
if (fTestNet)
|
||||
@@ -103,16 +112,6 @@ std::string ChainNameFromCommandLine()
|
||||
return CBaseChainParams::MAIN;
|
||||
}
|
||||
|
||||
bool SelectBaseParamsFromCommandLine()
|
||||
{
|
||||
std::string network = ChainNameFromCommandLine();
|
||||
if (network == CBaseChainParams::MAX_NETWORK_TYPES)
|
||||
return false;
|
||||
|
||||
SelectBaseParams(network);
|
||||
return true;
|
||||
}
|
||||
|
||||
bool AreBaseParamsConfigured()
|
||||
{
|
||||
return pCurrentBaseParams != NULL;
|
||||
|
||||
Reference in New Issue
Block a user