diff options
author | Jorge Timón <jtimon@jtimon.cc> | 2015-06-30 21:39:49 +0200 |
---|---|---|
committer | Jorge Timón <jtimon@jtimon.cc> | 2015-10-20 14:22:44 +0200 |
commit | f3525e24e3a156eaa004ca28a59fe2d449dc1f9e (patch) | |
tree | 6fceee33ff5c9efff9e97ea0045f4726239714b0 /src/chainparamsbase.h | |
parent | 49793fbb097e9f00149a054adeddad07f0444c12 (diff) |
Chainparams: Replace CBaseChainParams::Network enum with string constants (suggested by Wladimir)
Diffstat (limited to 'src/chainparamsbase.h')
-rw-r--r-- | src/chainparamsbase.h | 20 |
1 files changed, 9 insertions, 11 deletions
diff --git a/src/chainparamsbase.h b/src/chainparamsbase.h index 4369d0aef7..25a5b3450b 100644 --- a/src/chainparamsbase.h +++ b/src/chainparamsbase.h @@ -15,13 +15,11 @@ class CBaseChainParams { public: - enum Network { - MAIN, - TESTNET, - REGTEST, - - MAX_NETWORK_TYPES - }; + /** BIP70 chain name strings (main, test or regtest) */ + static const std::string MAIN; + static const std::string TESTNET; + static const std::string REGTEST; + static const std::string MAX_NETWORK_TYPES; const std::string& DataDir() const { return strDataDir; } int RPCPort() const { return nRPCPort; } @@ -40,13 +38,13 @@ protected: const CBaseChainParams& BaseParams(); /** Sets the params returned by Params() to those for the given network. */ -void SelectBaseParams(CBaseChainParams::Network network); +void SelectBaseParams(const std::string& chain); /** - * Looks for -regtest or -testnet and returns the appropriate Network ID. - * Returns MAX_NETWORK_TYPES if an invalid combination is given. + * Looks for -regtest, -testnet and returns the appropriate BIP70 chain name. + * @return CBaseChainParams::MAX_NETWORK_TYPES if an invalid combination is given. CBaseChainParams::MAIN by default. */ -CBaseChainParams::Network NetworkIdFromCommandLine(); +std::string ChainNameFromCommandLine(); /** * Calls NetworkIdFromCommandLine() and then calls SelectParams as appropriate. |