]> Git Repo - VerusCoin.git/blob - src/chainparamsbase.cpp
Remove unnecessary dependencies for bitcoin-cli
[VerusCoin.git] / src / chainparamsbase.cpp
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.
5
6 #include "chainparamsbase.h"
7
8 #include "assert.h"
9 #include "util.h"
10
11 #include <boost/assign/list_of.hpp>
12
13 using namespace boost::assign;
14
15 //
16 // Main network
17 //
18
19 class CBaseMainParams : public CBaseChainParams {
20 public:
21     CBaseMainParams() {
22         networkID = CBaseChainParams::MAIN;
23         nRPCPort = 8332;
24     }
25 };
26 static CBaseMainParams mainParams;
27
28 //
29 // Testnet (v3)
30 //
31 class CBaseTestNetParams : public CBaseMainParams {
32 public:
33     CBaseTestNetParams() {
34         networkID = CBaseChainParams::TESTNET;
35         nRPCPort = 18332;
36         strDataDir = "testnet3";
37     }
38 };
39 static CBaseTestNetParams testNetParams;
40
41 //
42 // Regression test
43 //
44 class CBaseRegTestParams : public CBaseTestNetParams {
45 public:
46     CBaseRegTestParams() {
47         networkID = CBaseChainParams::REGTEST;
48         strDataDir = "regtest";
49     }
50 };
51 static CBaseRegTestParams regTestParams;
52
53 static CBaseChainParams *pCurrentBaseParams = 0;
54
55 const CBaseChainParams &BaseParams() {
56     assert(pCurrentBaseParams);
57     return *pCurrentBaseParams;
58 }
59
60 void SelectBaseParams(CBaseChainParams::Network network) {
61     switch (network) {
62         case CBaseChainParams::MAIN:
63             pCurrentBaseParams = &mainParams;
64             break;
65         case CBaseChainParams::TESTNET:
66             pCurrentBaseParams = &testNetParams;
67             break;
68         case CBaseChainParams::REGTEST:
69             pCurrentBaseParams = &regTestParams;
70             break;
71         default:
72             assert(false && "Unimplemented network");
73             return;
74     }
75 }
76
77 bool SelectBaseParamsFromCommandLine() {
78     bool fRegTest = GetBoolArg("-regtest", false);
79     bool fTestNet = GetBoolArg("-testnet", false);
80
81     if (fTestNet && fRegTest) {
82         return false;
83     }
84
85     if (fRegTest) {
86         SelectBaseParams(CBaseChainParams::REGTEST);
87     } else if (fTestNet) {
88         SelectBaseParams(CBaseChainParams::TESTNET);
89     } else {
90         SelectBaseParams(CBaseChainParams::MAIN);
91     }
92     return true;
93 }
This page took 0.02669 seconds and 4 git commands to generate.