|
|
@ -1,6 +1,6 @@ |
|
|
|
// Copyright (c) 2010 Satoshi Nakamoto
|
|
|
|
// Copyright (c) 2010 Satoshi Nakamoto
|
|
|
|
// Copyright (c) 2009-2014 The Bitcoin developers
|
|
|
|
// Copyright (c) 2009-2014 The Bitcoin developers
|
|
|
|
// Distributed under the MIT/X11 software license, see the accompanying
|
|
|
|
// Distributed under the MIT software license, see the accompanying
|
|
|
|
// file COPYING or http://www.opensource.org/licenses/mit-license.php.
|
|
|
|
// file COPYING or http://www.opensource.org/licenses/mit-license.php.
|
|
|
|
|
|
|
|
|
|
|
|
#include "chainparams.h" |
|
|
|
#include "chainparams.h" |
|
|
@ -23,11 +23,11 @@ struct SeedSpec6 { |
|
|
|
|
|
|
|
|
|
|
|
#include "chainparamsseeds.h" |
|
|
|
#include "chainparamsseeds.h" |
|
|
|
|
|
|
|
|
|
|
|
//
|
|
|
|
/**
|
|
|
|
// Main network
|
|
|
|
* Main network |
|
|
|
//
|
|
|
|
*/ |
|
|
|
|
|
|
|
|
|
|
|
// Convert the pnSeeds6 array into usable address objects.
|
|
|
|
//! Convert the pnSeeds6 array into usable address objects.
|
|
|
|
static void convertSeed6(std::vector<CAddress> &vSeedsOut, const SeedSpec6 *data, unsigned int count) |
|
|
|
static void convertSeed6(std::vector<CAddress> &vSeedsOut, const SeedSpec6 *data, unsigned int count) |
|
|
|
{ |
|
|
|
{ |
|
|
|
// It'll only connect to one or two seed nodes because once it connects,
|
|
|
|
// It'll only connect to one or two seed nodes because once it connects,
|
|
|
@ -45,11 +45,13 @@ static void convertSeed6(std::vector<CAddress> &vSeedsOut, const SeedSpec6 *data |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
// What makes a good checkpoint block?
|
|
|
|
/**
|
|
|
|
// + Is surrounded by blocks with reasonable timestamps
|
|
|
|
* What makes a good checkpoint block? |
|
|
|
// (no blocks before with a timestamp after, none after with
|
|
|
|
* + Is surrounded by blocks with reasonable timestamps |
|
|
|
// timestamp before)
|
|
|
|
* (no blocks before with a timestamp after, none after with |
|
|
|
// + Contains no strange transactions
|
|
|
|
* timestamp before) |
|
|
|
|
|
|
|
* + Contains no strange transactions |
|
|
|
|
|
|
|
*/ |
|
|
|
static Checkpoints::MapCheckpoints mapCheckpoints = |
|
|
|
static Checkpoints::MapCheckpoints mapCheckpoints = |
|
|
|
boost::assign::map_list_of |
|
|
|
boost::assign::map_list_of |
|
|
|
( 11111, uint256("0x0000000069e244f73d78e8fd29ba2fd2ed618bd6fa2ee92559f542fdb26e7c1d")) |
|
|
|
( 11111, uint256("0x0000000069e244f73d78e8fd29ba2fd2ed618bd6fa2ee92559f542fdb26e7c1d")) |
|
|
@ -101,9 +103,11 @@ public: |
|
|
|
CMainParams() { |
|
|
|
CMainParams() { |
|
|
|
networkID = CBaseChainParams::MAIN; |
|
|
|
networkID = CBaseChainParams::MAIN; |
|
|
|
strNetworkID = "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
|
|
|
|
* The message start string is designed to be unlikely to occur in normal data. |
|
|
|
// a large 4-byte int at any alignment.
|
|
|
|
* The characters are rarely used upper ASCII, not valid as UTF-8, and produce |
|
|
|
|
|
|
|
* a large 4-byte int at any alignment. |
|
|
|
|
|
|
|
*/ |
|
|
|
pchMessageStart[0] = 0xf9; |
|
|
|
pchMessageStart[0] = 0xf9; |
|
|
|
pchMessageStart[1] = 0xbe; |
|
|
|
pchMessageStart[1] = 0xbe; |
|
|
|
pchMessageStart[2] = 0xb4; |
|
|
|
pchMessageStart[2] = 0xb4; |
|
|
@ -119,14 +123,16 @@ public: |
|
|
|
nTargetTimespan = 14 * 24 * 60 * 60; // two weeks
|
|
|
|
nTargetTimespan = 14 * 24 * 60 * 60; // two weeks
|
|
|
|
nTargetSpacing = 10 * 60; |
|
|
|
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.
|
|
|
|
* Build the genesis block. Note that the output of the genesis coinbase cannot |
|
|
|
//
|
|
|
|
* be spent as it did not originally exist in the database. |
|
|
|
// CBlock(hash=000000000019d6, ver=1, hashPrevBlock=00000000000000, hashMerkleRoot=4a5e1e, nTime=1231006505, nBits=1d00ffff, nNonce=2083236893, vtx=1)
|
|
|
|
* |
|
|
|
// CTransaction(hash=4a5e1e, ver=1, vin.size=1, vout.size=1, nLockTime=0)
|
|
|
|
* CBlock(hash=000000000019d6, ver=1, hashPrevBlock=00000000000000, hashMerkleRoot=4a5e1e, nTime=1231006505, nBits=1d00ffff, nNonce=2083236893, vtx=1) |
|
|
|
// CTxIn(COutPoint(000000, -1), coinbase 04ffff001d0104455468652054696d65732030332f4a616e2f32303039204368616e63656c6c6f72206f6e206272696e6b206f66207365636f6e64206261696c6f757420666f722062616e6b73)
|
|
|
|
* CTransaction(hash=4a5e1e, ver=1, vin.size=1, vout.size=1, nLockTime=0) |
|
|
|
// CTxOut(nValue=50.00000000, scriptPubKey=0x5F1DF16B2B704C8A578D0B)
|
|
|
|
* CTxIn(COutPoint(000000, -1), coinbase 04ffff001d0104455468652054696d65732030332f4a616e2f32303039204368616e63656c6c6f72206f6e206272696e6b206f66207365636f6e64206261696c6f757420666f722062616e6b73) |
|
|
|
// vMerkleTree: 4a5e1e
|
|
|
|
* CTxOut(nValue=50.00000000, scriptPubKey=0x5F1DF16B2B704C8A578D0B) |
|
|
|
|
|
|
|
* vMerkleTree: 4a5e1e |
|
|
|
|
|
|
|
*/ |
|
|
|
const char* pszTimestamp = "The Times 03/Jan/2009 Chancellor on brink of second bailout for banks"; |
|
|
|
const char* pszTimestamp = "The Times 03/Jan/2009 Chancellor on brink of second bailout for banks"; |
|
|
|
CMutableTransaction txNew; |
|
|
|
CMutableTransaction txNew; |
|
|
|
txNew.vin.resize(1); |
|
|
|
txNew.vin.resize(1); |
|
|
@ -178,18 +184,19 @@ public: |
|
|
|
}; |
|
|
|
}; |
|
|
|
static CMainParams mainParams; |
|
|
|
static CMainParams mainParams; |
|
|
|
|
|
|
|
|
|
|
|
//
|
|
|
|
/**
|
|
|
|
// Testnet (v3)
|
|
|
|
* Testnet (v3) |
|
|
|
//
|
|
|
|
*/ |
|
|
|
|
|
|
|
|
|
|
|
class CTestNetParams : public CMainParams { |
|
|
|
class CTestNetParams : public CMainParams { |
|
|
|
public: |
|
|
|
public: |
|
|
|
CTestNetParams() { |
|
|
|
CTestNetParams() { |
|
|
|
networkID = CBaseChainParams::TESTNET; |
|
|
|
networkID = CBaseChainParams::TESTNET; |
|
|
|
strNetworkID = "test"; |
|
|
|
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
|
|
|
|
* The message start string is designed to be unlikely to occur in normal data. |
|
|
|
// a large 4-byte int at any alignment.
|
|
|
|
* The characters are rarely used upper ASCII, not valid as UTF-8, and produce |
|
|
|
|
|
|
|
* a large 4-byte int at any alignment. |
|
|
|
|
|
|
|
*/ |
|
|
|
pchMessageStart[0] = 0x0b; |
|
|
|
pchMessageStart[0] = 0x0b; |
|
|
|
pchMessageStart[1] = 0x11; |
|
|
|
pchMessageStart[1] = 0x11; |
|
|
|
pchMessageStart[2] = 0x09; |
|
|
|
pchMessageStart[2] = 0x09; |
|
|
@ -200,10 +207,10 @@ public: |
|
|
|
nRejectBlockOutdatedMajority = 75; |
|
|
|
nRejectBlockOutdatedMajority = 75; |
|
|
|
nToCheckBlockUpgradeMajority = 100; |
|
|
|
nToCheckBlockUpgradeMajority = 100; |
|
|
|
nMinerThreads = 0; |
|
|
|
nMinerThreads = 0; |
|
|
|
nTargetTimespan = 14 * 24 * 60 * 60; // two weeks
|
|
|
|
nTargetTimespan = 14 * 24 * 60 * 60; //! two weeks
|
|
|
|
nTargetSpacing = 10 * 60; |
|
|
|
nTargetSpacing = 10 * 60; |
|
|
|
|
|
|
|
|
|
|
|
// Modify the testnet genesis block so the timestamp is valid for a later start.
|
|
|
|
//! Modify the testnet genesis block so the timestamp is valid for a later start.
|
|
|
|
genesis.nTime = 1296688602; |
|
|
|
genesis.nTime = 1296688602; |
|
|
|
genesis.nNonce = 414098458; |
|
|
|
genesis.nNonce = 414098458; |
|
|
|
hashGenesisBlock = genesis.GetHash(); |
|
|
|
hashGenesisBlock = genesis.GetHash(); |
|
|
@ -239,9 +246,9 @@ public: |
|
|
|
}; |
|
|
|
}; |
|
|
|
static CTestNetParams testNetParams; |
|
|
|
static CTestNetParams testNetParams; |
|
|
|
|
|
|
|
|
|
|
|
//
|
|
|
|
/**
|
|
|
|
// Regression test
|
|
|
|
* Regression test |
|
|
|
//
|
|
|
|
*/ |
|
|
|
class CRegTestParams : public CTestNetParams { |
|
|
|
class CRegTestParams : public CTestNetParams { |
|
|
|
public: |
|
|
|
public: |
|
|
|
CRegTestParams() { |
|
|
|
CRegTestParams() { |
|
|
@ -256,7 +263,7 @@ public: |
|
|
|
nRejectBlockOutdatedMajority = 950; |
|
|
|
nRejectBlockOutdatedMajority = 950; |
|
|
|
nToCheckBlockUpgradeMajority = 1000; |
|
|
|
nToCheckBlockUpgradeMajority = 1000; |
|
|
|
nMinerThreads = 1; |
|
|
|
nMinerThreads = 1; |
|
|
|
nTargetTimespan = 14 * 24 * 60 * 60; // two weeks
|
|
|
|
nTargetTimespan = 14 * 24 * 60 * 60; //! two weeks
|
|
|
|
nTargetSpacing = 10 * 60; |
|
|
|
nTargetSpacing = 10 * 60; |
|
|
|
bnProofOfWorkLimit = ~uint256(0) >> 1; |
|
|
|
bnProofOfWorkLimit = ~uint256(0) >> 1; |
|
|
|
genesis.nTime = 1296688602; |
|
|
|
genesis.nTime = 1296688602; |
|
|
@ -266,8 +273,8 @@ public: |
|
|
|
nDefaultPort = 18444; |
|
|
|
nDefaultPort = 18444; |
|
|
|
assert(hashGenesisBlock == uint256("0x0f9188f13cb7b2c71f2a335e3a4fc328bf5beb436012afca590b1a11466e2206")); |
|
|
|
assert(hashGenesisBlock == uint256("0x0f9188f13cb7b2c71f2a335e3a4fc328bf5beb436012afca590b1a11466e2206")); |
|
|
|
|
|
|
|
|
|
|
|
vFixedSeeds.clear(); // Regtest mode doesn't have any fixed seeds.
|
|
|
|
vFixedSeeds.clear(); //! Regtest mode doesn't have any fixed seeds.
|
|
|
|
vSeeds.clear(); // Regtest mode doesn't have any DNS seeds.
|
|
|
|
vSeeds.clear(); //! Regtest mode doesn't have any DNS seeds.
|
|
|
|
|
|
|
|
|
|
|
|
fRequireRPCPassword = false; |
|
|
|
fRequireRPCPassword = false; |
|
|
|
fMiningRequiresPeers = false; |
|
|
|
fMiningRequiresPeers = false; |
|
|
@ -284,17 +291,17 @@ public: |
|
|
|
}; |
|
|
|
}; |
|
|
|
static CRegTestParams regTestParams; |
|
|
|
static CRegTestParams regTestParams; |
|
|
|
|
|
|
|
|
|
|
|
//
|
|
|
|
/**
|
|
|
|
// Unit test
|
|
|
|
* Unit test |
|
|
|
//
|
|
|
|
*/ |
|
|
|
class CUnitTestParams : public CMainParams, public CModifiableParams { |
|
|
|
class CUnitTestParams : public CMainParams, public CModifiableParams { |
|
|
|
public: |
|
|
|
public: |
|
|
|
CUnitTestParams() { |
|
|
|
CUnitTestParams() { |
|
|
|
networkID = CBaseChainParams::UNITTEST; |
|
|
|
networkID = CBaseChainParams::UNITTEST; |
|
|
|
strNetworkID = "unittest"; |
|
|
|
strNetworkID = "unittest"; |
|
|
|
nDefaultPort = 18445; |
|
|
|
nDefaultPort = 18445; |
|
|
|
vFixedSeeds.clear(); |
|
|
|
vFixedSeeds.clear(); //! Unit test mode doesn't have any fixed seeds.
|
|
|
|
vSeeds.clear(); // Regtest mode doesn't have any DNS seeds.
|
|
|
|
vSeeds.clear(); //! Unit test mode doesn't have any DNS seeds.
|
|
|
|
|
|
|
|
|
|
|
|
fRequireRPCPassword = false; |
|
|
|
fRequireRPCPassword = false; |
|
|
|
fMiningRequiresPeers = false; |
|
|
|
fMiningRequiresPeers = false; |
|
|
@ -309,7 +316,7 @@ public: |
|
|
|
return data; |
|
|
|
return data; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
// Published setters to allow changing values in unit test cases
|
|
|
|
//! Published setters to allow changing values in unit test cases
|
|
|
|
virtual void setSubsidyHalvingInterval(int anSubsidyHalvingInterval) { nSubsidyHalvingInterval=anSubsidyHalvingInterval; } |
|
|
|
virtual void setSubsidyHalvingInterval(int anSubsidyHalvingInterval) { nSubsidyHalvingInterval=anSubsidyHalvingInterval; } |
|
|
|
virtual void setEnforceBlockUpgradeMajority(int anEnforceBlockUpgradeMajority) { nEnforceBlockUpgradeMajority=anEnforceBlockUpgradeMajority; } |
|
|
|
virtual void setEnforceBlockUpgradeMajority(int anEnforceBlockUpgradeMajority) { nEnforceBlockUpgradeMajority=anEnforceBlockUpgradeMajority; } |
|
|
|
virtual void setRejectBlockOutdatedMajority(int anRejectBlockOutdatedMajority) { nRejectBlockOutdatedMajority=anRejectBlockOutdatedMajority; } |
|
|
|
virtual void setRejectBlockOutdatedMajority(int anRejectBlockOutdatedMajority) { nRejectBlockOutdatedMajority=anRejectBlockOutdatedMajority; } |
|
|
|