aboutsummaryrefslogtreecommitdiff
path: root/src/chainparamsbase.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/chainparamsbase.cpp')
-rw-r--r--src/chainparamsbase.cpp25
1 files changed, 15 insertions, 10 deletions
diff --git a/src/chainparamsbase.cpp b/src/chainparamsbase.cpp
index 98bb5b855f..05ef5dd463 100644
--- a/src/chainparamsbase.cpp
+++ b/src/chainparamsbase.cpp
@@ -83,22 +83,27 @@ void SelectBaseParams(CBaseChainParams::Network network)
}
}
-bool SelectBaseParamsFromCommandLine()
+CBaseChainParams::Network CBaseChainParams::NetworkIdFromCommandLine()
{
bool fRegTest = GetBoolArg("-regtest", false);
bool fTestNet = GetBoolArg("-testnet", false);
- if (fTestNet && fRegTest) {
+ if (fTestNet && fRegTest)
+ return MAX_NETWORK_TYPES;
+ if (fRegTest)
+ return REGTEST;
+ if (fTestNet)
+ return TESTNET;
+ return MAIN;
+}
+
+bool SelectBaseParamsFromCommandLine()
+{
+ CBaseChainParams::Network network = CBaseChainParams::NetworkIdFromCommandLine();
+ if (network == CBaseChainParams::MAX_NETWORK_TYPES)
return false;
- }
- if (fRegTest) {
- SelectBaseParams(CBaseChainParams::REGTEST);
- } else if (fTestNet) {
- SelectBaseParams(CBaseChainParams::TESTNET);
- } else {
- SelectBaseParams(CBaseChainParams::MAIN);
- }
+ SelectBaseParams(network);
return true;
}