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