diff options
author | Jorge Timón <jtimon@jtimon.cc> | 2015-05-25 09:00:17 +0200 |
---|---|---|
committer | Jorge Timón <jtimon@jtimon.cc> | 2015-10-20 14:28:43 +0200 |
commit | 55a89751faaada5598771d10401030e9e86eecbd (patch) | |
tree | 87607d31265c50db8955f805d280faeb8e82ab03 /src/chainparamsbase.cpp | |
parent | f3525e24e3a156eaa004ca28a59fe2d449dc1f9e (diff) |
Chainparams: Translations: DRY: options and error strings
Also remove SelectBaseParamsFromCommandLine and SelectParamsFromCommandLine
Diffstat (limited to 'src/chainparamsbase.cpp')
-rw-r--r-- | src/chainparamsbase.cpp | 23 |
1 files changed, 11 insertions, 12 deletions
diff --git a/src/chainparamsbase.cpp b/src/chainparamsbase.cpp index e46212279f..db2dc751f5 100644 --- a/src/chainparamsbase.cpp +++ b/src/chainparamsbase.cpp @@ -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; |