1 // Copyright (c) 2010 Satoshi Nakamoto
2 // Copyright (c) 2009-2014 The Bitcoin developers
3 // Distributed under the MIT/X11 software license, see the accompanying
4 // file COPYING or http://www.opensource.org/licenses/mit-license.php.
6 #include "chainparamsbase.h"
11 #include <boost/assign/list_of.hpp>
13 using namespace boost::assign;
19 class CBaseMainParams : public CBaseChainParams {
22 networkID = CBaseChainParams::MAIN;
26 static CBaseMainParams mainParams;
31 class CBaseTestNetParams : public CBaseMainParams {
33 CBaseTestNetParams() {
34 networkID = CBaseChainParams::TESTNET;
36 strDataDir = "testnet3";
39 static CBaseTestNetParams testNetParams;
44 class CBaseRegTestParams : public CBaseTestNetParams {
46 CBaseRegTestParams() {
47 networkID = CBaseChainParams::REGTEST;
48 strDataDir = "regtest";
51 static CBaseRegTestParams regTestParams;
53 static CBaseChainParams *pCurrentBaseParams = 0;
55 const CBaseChainParams &BaseParams() {
56 assert(pCurrentBaseParams);
57 return *pCurrentBaseParams;
60 void SelectBaseParams(CBaseChainParams::Network network) {
62 case CBaseChainParams::MAIN:
63 pCurrentBaseParams = &mainParams;
65 case CBaseChainParams::TESTNET:
66 pCurrentBaseParams = &testNetParams;
68 case CBaseChainParams::REGTEST:
69 pCurrentBaseParams = ®TestParams;
72 assert(false && "Unimplemented network");
77 bool SelectBaseParamsFromCommandLine() {
78 bool fRegTest = GetBoolArg("-regtest", false);
79 bool fTestNet = GetBoolArg("-testnet", false);
81 if (fTestNet && fRegTest) {
86 SelectBaseParams(CBaseChainParams::REGTEST);
87 } else if (fTestNet) {
88 SelectBaseParams(CBaseChainParams::TESTNET);
90 SelectBaseParams(CBaseChainParams::MAIN);