aboutsummaryrefslogtreecommitdiff
path: root/src/chainparams.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/chainparams.cpp')
-rw-r--r--src/chainparams.cpp43
1 files changed, 19 insertions, 24 deletions
diff --git a/src/chainparams.cpp b/src/chainparams.cpp
index afbae6fc57..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,13 +110,14 @@ public:
pchMessageStart[3] = 0xd9;
vAlertPubKey = ParseHex("04fc9702847840aaf195de8442ebecedf5b095cdbb9bc716bda9110971b28a49e0ead8564ff0db22209e0374782c093bb899692d524e9d6a6956e7c5ecbcd68284");
nDefaultPort = 8333;
- nRPCPort = 8332;
bnProofOfWorkLimit = ~uint256(0) >> 32;
nSubsidyHalvingInterval = 210000;
nEnforceBlockUpgradeMajority = 750;
nRejectBlockOutdatedMajority = 950;
nToCheckBlockUpgradeMajority = 1000;
nMinerThreads = 0;
+ nTargetTimespan = 14 * 24 * 60 * 60; // two weeks
+ nTargetSpacing = 10 * 60;
// Build the genesis block. Note that the output of the genesis coinbase cannot
// be spent as it did not originally exist in the database.
@@ -189,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
@@ -200,11 +201,12 @@ public:
pchMessageStart[3] = 0x07;
vAlertPubKey = ParseHex("04302390343f91cc401d56d68b123028bf52e5fca1939df127f63c6467cdf9c8e2c14b61104cf817d0b780da337893ecc4aaff1309e536162dabbdb45200ca2b0a");
nDefaultPort = 18333;
- nRPCPort = 18332;
nEnforceBlockUpgradeMajority = 51;
nRejectBlockOutdatedMajority = 75;
nToCheckBlockUpgradeMajority = 100;
- strDataDir = "testnet3";
+ nMinerThreads = 0;
+ nTargetTimespan = 14 * 24 * 60 * 60; // two weeks
+ nTargetSpacing = 10 * 60;
// Modify the testnet genesis block so the timestamp is valid for a later start.
genesis.nTime = 1296688602;
@@ -240,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;
@@ -251,13 +253,14 @@ public:
nRejectBlockOutdatedMajority = 950;
nToCheckBlockUpgradeMajority = 1000;
nMinerThreads = 1;
+ nTargetTimespan = 14 * 24 * 60 * 60; // two weeks
+ nTargetSpacing = 10 * 60;
bnProofOfWorkLimit = ~uint256(0) >> 1;
genesis.nTime = 1296688602;
genesis.nBits = 0x207fffff;
genesis.nNonce = 2;
hashGenesisBlock = genesis.GetHash();
nDefaultPort = 18444;
- strDataDir = "regtest";
assert(hashGenesisBlock == uint256("0x0f9188f13cb7b2c71f2a335e3a4fc328bf5beb436012afca590b1a11466e2206"));
vSeeds.clear(); // Regtest mode doesn't have any DNS seeds.
@@ -272,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:
@@ -296,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;
}