aboutsummaryrefslogtreecommitdiff
path: root/src/chainparams.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/chainparams.cpp')
-rw-r--r--src/chainparams.cpp36
1 files changed, 12 insertions, 24 deletions
diff --git a/src/chainparams.cpp b/src/chainparams.cpp
index eb56af750e..63067a153d 100644
--- a/src/chainparams.cpp
+++ b/src/chainparams.cpp
@@ -99,7 +99,7 @@ unsigned int pnSeed[] =
class CMainParams : public CChainParams {
public:
CMainParams() {
- networkID = CChainParams::MAIN;
+ networkID = CBaseChainParams::MAIN;
strNetworkID = "main";
// The message start string is designed to be unlikely to occur in normal data.
// The characters are rarely used upper ASCII, not valid as UTF-8, and produce
@@ -110,7 +110,6 @@ public:
pchMessageStart[3] = 0xd9;
vAlertPubKey = ParseHex("04fc9702847840aaf195de8442ebecedf5b095cdbb9bc716bda9110971b28a49e0ead8564ff0db22209e0374782c093bb899692d524e9d6a6956e7c5ecbcd68284");
nDefaultPort = 8333;
- nRPCPort = 8332;
bnProofOfWorkLimit = ~uint256(0) >> 32;
nSubsidyHalvingInterval = 210000;
nEnforceBlockUpgradeMajority = 750;
@@ -191,7 +190,7 @@ static CMainParams mainParams;
class CTestNetParams : public CMainParams {
public:
CTestNetParams() {
- networkID = CChainParams::TESTNET;
+ networkID = CBaseChainParams::TESTNET;
strNetworkID = "test";
// The message start string is designed to be unlikely to occur in normal data.
// The characters are rarely used upper ASCII, not valid as UTF-8, and produce
@@ -202,14 +201,12 @@ public:
pchMessageStart[3] = 0x07;
vAlertPubKey = ParseHex("04302390343f91cc401d56d68b123028bf52e5fca1939df127f63c6467cdf9c8e2c14b61104cf817d0b780da337893ecc4aaff1309e536162dabbdb45200ca2b0a");
nDefaultPort = 18333;
- nRPCPort = 18332;
nEnforceBlockUpgradeMajority = 51;
nRejectBlockOutdatedMajority = 75;
nToCheckBlockUpgradeMajority = 100;
nMinerThreads = 0;
nTargetTimespan = 14 * 24 * 60 * 60; // two weeks
nTargetSpacing = 10 * 60;
- strDataDir = "testnet3";
// Modify the testnet genesis block so the timestamp is valid for a later start.
genesis.nTime = 1296688602;
@@ -245,7 +242,7 @@ static CTestNetParams testNetParams;
class CRegTestParams : public CTestNetParams {
public:
CRegTestParams() {
- networkID = CChainParams::REGTEST;
+ networkID = CBaseChainParams::REGTEST;
strNetworkID = "regtest";
pchMessageStart[0] = 0xfa;
pchMessageStart[1] = 0xbf;
@@ -264,7 +261,6 @@ public:
genesis.nNonce = 2;
hashGenesisBlock = genesis.GetHash();
nDefaultPort = 18444;
- strDataDir = "regtest";
assert(hashGenesisBlock == uint256("0x0f9188f13cb7b2c71f2a335e3a4fc328bf5beb436012afca590b1a11466e2206"));
vSeeds.clear(); // Regtest mode doesn't have any DNS seeds.
@@ -279,21 +275,23 @@ public:
};
static CRegTestParams regTestParams;
-static CChainParams *pCurrentParams = &mainParams;
+static CChainParams *pCurrentParams = 0;
const CChainParams &Params() {
+ assert(pCurrentParams);
return *pCurrentParams;
}
-void SelectParams(CChainParams::Network network) {
+void SelectParams(CBaseChainParams::Network network) {
+ SelectBaseParams(network);
switch (network) {
- case CChainParams::MAIN:
+ case CBaseChainParams::MAIN:
pCurrentParams = &mainParams;
break;
- case CChainParams::TESTNET:
+ case CBaseChainParams::TESTNET:
pCurrentParams = &testNetParams;
break;
- case CChainParams::REGTEST:
+ case CBaseChainParams::REGTEST:
pCurrentParams = &regTestParams;
break;
default:
@@ -303,19 +301,9 @@ void SelectParams(CChainParams::Network network) {
}
bool SelectParamsFromCommandLine() {
- bool fRegTest = GetBoolArg("-regtest", false);
- bool fTestNet = GetBoolArg("-testnet", false);
-
- if (fTestNet && fRegTest) {
+ if (!SelectBaseParamsFromCommandLine())
return false;
- }
- if (fRegTest) {
- SelectParams(CChainParams::REGTEST);
- } else if (fTestNet) {
- SelectParams(CChainParams::TESTNET);
- } else {
- SelectParams(CChainParams::MAIN);
- }
+ SelectParams(BaseParams().NetworkID());
return true;
}