2013-05-07 15:16:25 +02:00
|
|
|
// Copyright (c) 2010 Satoshi Nakamoto
|
2015-12-13 17:58:29 +01:00
|
|
|
// Copyright (c) 2009-2015 The Bitcoin Core developers
|
2014-10-25 17:24:16 +08:00
|
|
|
// Distributed under the MIT software license, see the accompanying
|
2013-05-07 15:16:25 +02:00
|
|
|
// file COPYING or http://www.opensource.org/licenses/mit-license.php.
|
|
|
|
|
|
|
|
|
|
#include "chainparams.h"
|
2015-11-17 17:35:44 +01:00
|
|
|
#include "consensus/merkle.h"
|
2013-04-13 00:13:08 -05:00
|
|
|
|
2015-06-30 21:39:49 +02:00
|
|
|
#include "tinyformat.h"
|
2013-05-07 15:16:25 +02:00
|
|
|
#include "util.h"
|
2014-09-24 23:32:36 -04:00
|
|
|
#include "utilstrencodings.h"
|
2016-03-14 16:27:43 -07:00
|
|
|
#include "amount.h"
|
2013-05-07 15:16:25 +02:00
|
|
|
|
2014-08-28 22:56:53 +02:00
|
|
|
#include <assert.h>
|
|
|
|
|
|
2013-06-23 02:33:47 +02:00
|
|
|
#include <boost/assign/list_of.hpp>
|
2015-05-22 03:50:01 +02:00
|
|
|
#include <boost/scoped_ptr.hpp>
|
2013-06-23 02:33:47 +02:00
|
|
|
|
2014-07-24 13:52:57 +02:00
|
|
|
#include "chainparamsseeds.h"
|
|
|
|
|
|
2016-03-14 16:27:43 -07:00
|
|
|
static CBlock CreateGenesisBlock(const char* pszTimestamp, const CScript& genesisOutputScript, uint32_t nTime, const CScript& scriptChallenge, int32_t nVersion, const CAmount& genesisReward, const uint32_t rewardShards)
|
2015-07-03 14:29:57 +02:00
|
|
|
{
|
2016-03-14 16:27:43 -07:00
|
|
|
// Shards must be evenly divisible
|
|
|
|
|
assert(MAX_MONEY % rewardShards == 0);
|
2015-07-03 14:29:57 +02:00
|
|
|
CMutableTransaction txNew;
|
|
|
|
|
txNew.nVersion = 1;
|
|
|
|
|
txNew.vin.resize(1);
|
2015-06-05 16:01:44 -04:00
|
|
|
txNew.vin[0].scriptSig = CScript() << 486604799 << CScriptNum(4) << std::vector<unsigned char>((const unsigned char*)pszTimestamp, (const unsigned char*)pszTimestamp + strlen(pszTimestamp));
|
2016-03-14 16:27:43 -07:00
|
|
|
txNew.vout.resize(rewardShards);
|
|
|
|
|
for (unsigned int i = 0; i < rewardShards; i++) {
|
|
|
|
|
txNew.vout[i].nValue = genesisReward/rewardShards;
|
|
|
|
|
txNew.vout[i].scriptPubKey = genesisOutputScript;
|
|
|
|
|
}
|
2015-07-03 14:29:57 +02:00
|
|
|
|
|
|
|
|
CBlock genesis;
|
|
|
|
|
genesis.nTime = nTime;
|
2016-03-18 21:39:01 -07:00
|
|
|
genesis.proof = CProof(scriptChallenge, CScript());
|
2015-07-03 14:29:57 +02:00
|
|
|
genesis.nVersion = nVersion;
|
|
|
|
|
genesis.vtx.push_back(txNew);
|
|
|
|
|
genesis.hashPrevBlock.SetNull();
|
2015-11-17 17:35:44 +01:00
|
|
|
genesis.hashMerkleRoot = BlockMerkleRoot(genesis);
|
2015-07-03 14:29:57 +02:00
|
|
|
return genesis;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
2015-11-17 02:38:31 +01:00
|
|
|
* Elements Beta.
|
2015-07-03 14:29:57 +02:00
|
|
|
*/
|
2015-11-17 02:38:31 +01:00
|
|
|
class CElementsParams : public CChainParams {
|
2013-05-07 15:16:25 +02:00
|
|
|
public:
|
2015-11-17 02:38:31 +01:00
|
|
|
CElementsParams() {
|
|
|
|
|
strNetworkID = CHAINPARAMS_ELEMENTS;
|
2015-02-11 11:58:11 +01:00
|
|
|
consensus.nSubsidyHalvingInterval = 210000;
|
|
|
|
|
consensus.nMajorityEnforceBlockUpgrade = 750;
|
|
|
|
|
consensus.nMajorityRejectBlockOutdated = 950;
|
|
|
|
|
consensus.nMajorityWindow = 1000;
|
2015-11-02 16:41:55 -05:00
|
|
|
consensus.BIP34Height = 227931;
|
|
|
|
|
consensus.BIP34Hash = uint256S("0x000000000000024b89b42a942fe0d9fea3bb44ab7bd1b19115dd6a759c0808b8");
|
2015-03-25 15:00:32 -04:00
|
|
|
consensus.powLimit = uint256S("00000000ffffffffffffffffffffffffffffffffffffffffffffffffffffffff");
|
2016-06-09 13:23:11 -04:00
|
|
|
// Peg-ins Bitcoin headers must have higher difficulty target than this field
|
|
|
|
|
// This value must be sufficiently small to not preclude realistic parent
|
|
|
|
|
// chain difficulty during network lifespan yet sufficiently large to
|
|
|
|
|
// deny peg-in DoS attacks due to our inability to ban after failed
|
|
|
|
|
// IsBitcoinBlock RPC checks.
|
|
|
|
|
consensus.parentChainPowLimit = uint256S("00000000ffffffffffffffffffffffffffffffffffffffffffffffffffffffff");
|
2015-02-11 11:58:11 +01:00
|
|
|
consensus.nPowTargetTimespan = 14 * 24 * 60 * 60; // two weeks
|
|
|
|
|
consensus.nPowTargetSpacing = 10 * 60;
|
|
|
|
|
consensus.fPowAllowMinDifficultyBlocks = false;
|
2015-10-19 08:25:29 -04:00
|
|
|
consensus.fPowNoRetargeting = false;
|
2016-02-15 05:13:27 +01:00
|
|
|
consensus.nRuleChangeActivationThreshold = 1916; // 95% of 2016
|
|
|
|
|
consensus.nMinerConfirmationWindow = 2016; // nPowTargetTimespan / nPowTargetSpacing
|
2016-03-09 16:00:53 -05:00
|
|
|
consensus.vDeployments[Consensus::DEPLOYMENT_TESTDUMMY].bit = 28;
|
|
|
|
|
consensus.vDeployments[Consensus::DEPLOYMENT_TESTDUMMY].nStartTime = 1199145601; // January 1, 2008
|
|
|
|
|
consensus.vDeployments[Consensus::DEPLOYMENT_TESTDUMMY].nTimeout = 1230767999; // December 31, 2008
|
2016-02-20 23:37:13 +01:00
|
|
|
|
|
|
|
|
// Deployment of BIP68, BIP112, and BIP113.
|
|
|
|
|
consensus.vDeployments[Consensus::DEPLOYMENT_CSV].bit = 0;
|
|
|
|
|
consensus.vDeployments[Consensus::DEPLOYMENT_CSV].nStartTime = 1462060800; // May 1st, 2016
|
|
|
|
|
consensus.vDeployments[Consensus::DEPLOYMENT_CSV].nTimeout = 1493596800; // May 1st, 2017
|
|
|
|
|
|
2016-10-17 13:24:37 +02:00
|
|
|
// Deployment of SegWit (BIP141, BIP143, and BIP147)
|
2015-11-06 01:42:38 +01:00
|
|
|
consensus.vDeployments[Consensus::DEPLOYMENT_SEGWIT].bit = 1;
|
2016-10-17 13:24:37 +02:00
|
|
|
consensus.vDeployments[Consensus::DEPLOYMENT_SEGWIT].nStartTime = 1479168000; // November 15th, 2016.
|
|
|
|
|
consensus.vDeployments[Consensus::DEPLOYMENT_SEGWIT].nTimeout = 1510704000; // November 15th, 2017.
|
2015-11-06 01:42:38 +01:00
|
|
|
|
2016-02-20 23:37:13 +01:00
|
|
|
/**
|
2014-10-25 17:24:16 +08:00
|
|
|
* 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
|
2015-04-28 14:47:17 +00:00
|
|
|
* a large 32-bit integer with any alignment.
|
2014-10-25 17:24:16 +08:00
|
|
|
*/
|
2016-03-07 02:45:47 -05:00
|
|
|
pchMessageStart[0] = 0xef;
|
|
|
|
|
pchMessageStart[1] = 0xb1;
|
2015-11-17 02:38:31 +01:00
|
|
|
pchMessageStart[2] = 0x1f;
|
2016-03-07 02:45:47 -05:00
|
|
|
pchMessageStart[3] = 0xea;
|
|
|
|
|
nDefaultPort = 9042;
|
Add block pruning functionality
This adds a -prune=N option to bitcoind, which if set to N>0 will enable block
file pruning. When pruning is enabled, block and undo files will be deleted to
try to keep total space used by those files to below the prune target (N, in
MB) specified by the user, subject to some constraints:
- The last 288 blocks on the main chain are always kept (MIN_BLOCKS_TO_KEEP),
- N must be at least 550MB (chosen as a value for the target that could
reasonably be met, with some assumptions about block sizes, orphan rates,
etc; see comment in main.h),
- No blocks are pruned until chainActive is at least 100,000 blocks long (on
mainnet; defined separately for mainnet, testnet, and regtest in chainparams
as nPruneAfterHeight).
This unsets NODE_NETWORK if pruning is enabled.
Also included is an RPC test for pruning (pruning.py).
Thanks to @rdponticelli for earlier work on this feature; this is based in
part off that work.
2015-02-23 14:27:44 -05:00
|
|
|
nPruneAfterHeight = 100000;
|
2013-05-07 15:16:25 +02:00
|
|
|
|
2016-03-26 16:23:23 -07:00
|
|
|
CScript scriptChallenge(CScript() << OP_2 << ParseHex("03206b45265ae687dfdc602b8faa7dd749d7865b0e51f986e12c532229f0c998be") << ParseHex("02cc276552e180061f64dc16e2a02e7f9ecbcc744dea84eddbe991721824df825c") << ParseHex("0204c6be425356d9200a3303d95f2c39078cc9473ca49619da1e0ec233f27516ca") << OP_3 << OP_CHECKMULTISIG);
|
2016-03-18 21:39:01 -07:00
|
|
|
|
|
|
|
|
uint256 genesisBlockHash(uint256S("000000000933ea01ad0ee984209779baaec3ced90fa3f408719526f8d77f4943"));
|
|
|
|
|
CScript scriptDestination(CScript() << std::vector<unsigned char>(genesisBlockHash.begin(), genesisBlockHash.end()) << OP_WITHDRAWPROOFVERIFY);
|
2016-03-14 16:27:43 -07:00
|
|
|
genesis = CreateGenesisBlock(strNetworkID.c_str(), scriptDestination, 1231006505, scriptChallenge, 1, MAX_MONEY, 100);
|
2015-02-11 11:58:11 +01:00
|
|
|
consensus.hashGenesisBlock = genesis.GetHash();
|
2013-05-07 15:16:25 +02:00
|
|
|
|
2016-03-26 16:13:39 -07:00
|
|
|
scriptCoinbaseDestination = CScript() << ParseHex("0229536c4c83789f59c30b93eb40d4abbd99b8dcc99ba8bd748f29e33c1d279e3c") << OP_CHECKSIG;
|
|
|
|
|
|
2015-11-17 02:38:31 +01:00
|
|
|
vFixedSeeds.clear(); //! TODO
|
|
|
|
|
vSeeds.clear(); //! TODO
|
2013-05-07 15:16:25 +02:00
|
|
|
|
2014-06-04 12:51:29 +02:00
|
|
|
fMiningRequiresPeers = true;
|
2015-03-13 09:25:34 -07:00
|
|
|
fDefaultConsistencyChecks = false;
|
2014-06-04 12:51:29 +02:00
|
|
|
fRequireStandard = true;
|
|
|
|
|
fMineBlocksOnDemand = false;
|
2015-11-17 02:38:31 +01:00
|
|
|
fTestnetToBeDeprecatedFieldRPC = true;
|
2014-08-31 21:32:23 +02:00
|
|
|
|
2015-11-17 02:38:31 +01:00
|
|
|
checkpointData = (CCheckpointData){
|
2015-04-23 18:30:55 -04:00
|
|
|
boost::assign::map_list_of
|
2015-11-17 02:38:31 +01:00
|
|
|
( 0, consensus.hashGenesisBlock),
|
|
|
|
|
0,
|
|
|
|
|
0,
|
|
|
|
|
0
|
2015-04-23 18:30:55 -04:00
|
|
|
};
|
2015-11-17 02:38:31 +01:00
|
|
|
base58Prefixes[PUBKEY_ADDRESS] = std::vector<unsigned char>(1,111);
|
|
|
|
|
base58Prefixes[SCRIPT_ADDRESS] = std::vector<unsigned char>(1,196);
|
2016-02-29 13:44:46 -05:00
|
|
|
base58Prefixes[BLINDED_ADDRESS]= std::vector<unsigned char>(1,26);
|
2015-11-17 02:38:31 +01:00
|
|
|
base58Prefixes[SECRET_KEY] = std::vector<unsigned char>(1,239);
|
|
|
|
|
base58Prefixes[EXT_PUBLIC_KEY] = boost::assign::list_of(0x04)(0x35)(0x87)(0xCF).convert_to_container<std::vector<unsigned char> >();
|
|
|
|
|
base58Prefixes[EXT_SECRET_KEY] = boost::assign::list_of(0x04)(0x35)(0x83)(0x94).convert_to_container<std::vector<unsigned char> >();
|
|
|
|
|
}
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Use production base58 for tests
|
|
|
|
|
*/
|
|
|
|
|
class CMainParams : public CElementsParams {
|
|
|
|
|
public:
|
|
|
|
|
CMainParams() : CElementsParams() {
|
|
|
|
|
strNetworkID = CHAINPARAMS_OLD_MAIN;
|
|
|
|
|
|
|
|
|
|
base58Prefixes[PUBKEY_ADDRESS] = std::vector<unsigned char>(1,0);
|
|
|
|
|
base58Prefixes[SCRIPT_ADDRESS] = std::vector<unsigned char>(1,5);
|
2016-02-29 13:44:46 -05:00
|
|
|
base58Prefixes[BLINDED_ADDRESS]= std::vector<unsigned char>(1,11);
|
2015-11-17 02:38:31 +01:00
|
|
|
base58Prefixes[SECRET_KEY] = std::vector<unsigned char>(1,128);
|
|
|
|
|
base58Prefixes[EXT_PUBLIC_KEY] = boost::assign::list_of(0x04)(0x88)(0xB2)(0x1E).convert_to_container<std::vector<unsigned char> >();
|
|
|
|
|
base58Prefixes[EXT_SECRET_KEY] = boost::assign::list_of(0x04)(0x88)(0xAD)(0xE4).convert_to_container<std::vector<unsigned char> >();
|
2014-08-31 21:32:23 +02:00
|
|
|
}
|
2013-05-07 15:16:25 +02:00
|
|
|
};
|
|
|
|
|
|
2014-10-25 17:24:16 +08:00
|
|
|
/**
|
|
|
|
|
* Regression test
|
|
|
|
|
*/
|
2015-07-03 14:30:18 +02:00
|
|
|
class CRegTestParams : public CChainParams {
|
2013-05-07 15:16:25 +02:00
|
|
|
public:
|
|
|
|
|
CRegTestParams() {
|
2015-11-17 02:38:31 +01:00
|
|
|
strNetworkID = CHAINPARAMS_REGTEST;
|
2015-02-11 11:58:11 +01:00
|
|
|
consensus.nSubsidyHalvingInterval = 150;
|
|
|
|
|
consensus.nMajorityEnforceBlockUpgrade = 750;
|
|
|
|
|
consensus.nMajorityRejectBlockOutdated = 950;
|
|
|
|
|
consensus.nMajorityWindow = 1000;
|
2015-11-02 16:41:55 -05:00
|
|
|
consensus.BIP34Height = -1; // BIP34 has not necessarily activated on regtest
|
|
|
|
|
consensus.BIP34Hash = uint256();
|
2015-03-25 15:00:32 -04:00
|
|
|
consensus.powLimit = uint256S("7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff");
|
2016-06-09 13:23:11 -04:00
|
|
|
consensus.parentChainPowLimit = uint256S("7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff");
|
2015-07-03 14:30:18 +02:00
|
|
|
consensus.nPowTargetTimespan = 14 * 24 * 60 * 60; // two weeks
|
|
|
|
|
consensus.nPowTargetSpacing = 10 * 60;
|
|
|
|
|
consensus.fPowAllowMinDifficultyBlocks = true;
|
2015-10-19 08:25:29 -04:00
|
|
|
consensus.fPowNoRetargeting = true;
|
2016-02-15 05:13:27 +01:00
|
|
|
consensus.nRuleChangeActivationThreshold = 108; // 75% for testchains
|
|
|
|
|
consensus.nMinerConfirmationWindow = 144; // Faster than normal for regtest (144 instead of 2016)
|
2016-03-09 16:00:53 -05:00
|
|
|
consensus.vDeployments[Consensus::DEPLOYMENT_TESTDUMMY].bit = 28;
|
|
|
|
|
consensus.vDeployments[Consensus::DEPLOYMENT_TESTDUMMY].nStartTime = 0;
|
|
|
|
|
consensus.vDeployments[Consensus::DEPLOYMENT_TESTDUMMY].nTimeout = 999999999999ULL;
|
2016-02-20 23:37:13 +01:00
|
|
|
consensus.vDeployments[Consensus::DEPLOYMENT_CSV].bit = 0;
|
|
|
|
|
consensus.vDeployments[Consensus::DEPLOYMENT_CSV].nStartTime = 0;
|
|
|
|
|
consensus.vDeployments[Consensus::DEPLOYMENT_CSV].nTimeout = 999999999999ULL;
|
2015-11-06 01:42:38 +01:00
|
|
|
consensus.vDeployments[Consensus::DEPLOYMENT_SEGWIT].bit = 1;
|
|
|
|
|
consensus.vDeployments[Consensus::DEPLOYMENT_SEGWIT].nStartTime = 0;
|
|
|
|
|
consensus.vDeployments[Consensus::DEPLOYMENT_SEGWIT].nTimeout = 999999999999ULL;
|
2015-07-29 21:13:36 +02:00
|
|
|
|
2013-05-07 15:16:25 +02:00
|
|
|
pchMessageStart[0] = 0xfa;
|
|
|
|
|
pchMessageStart[1] = 0xbf;
|
|
|
|
|
pchMessageStart[2] = 0xb5;
|
|
|
|
|
pchMessageStart[3] = 0xda;
|
2016-03-07 02:45:47 -05:00
|
|
|
nDefaultPort = 7042;
|
Add block pruning functionality
This adds a -prune=N option to bitcoind, which if set to N>0 will enable block
file pruning. When pruning is enabled, block and undo files will be deleted to
try to keep total space used by those files to below the prune target (N, in
MB) specified by the user, subject to some constraints:
- The last 288 blocks on the main chain are always kept (MIN_BLOCKS_TO_KEEP),
- N must be at least 550MB (chosen as a value for the target that could
reasonably be met, with some assumptions about block sizes, orphan rates,
etc; see comment in main.h),
- No blocks are pruned until chainActive is at least 100,000 blocks long (on
mainnet; defined separately for mainnet, testnet, and regtest in chainparams
as nPruneAfterHeight).
This unsets NODE_NETWORK if pruning is enabled.
Also included is an RPC test for pruning (pruning.py).
Thanks to @rdponticelli for earlier work on this feature; this is based in
part off that work.
2015-02-23 14:27:44 -05:00
|
|
|
nPruneAfterHeight = 1000;
|
2013-05-07 15:16:25 +02:00
|
|
|
|
2015-11-17 02:38:31 +01:00
|
|
|
CScript scriptDestination(CScript() << OP_TRUE);
|
2016-03-14 16:27:43 -07:00
|
|
|
genesis = CreateGenesisBlock(strNetworkID.c_str(), scriptDestination, 1296688602, scriptDestination, 1, MAX_MONEY, 100);
|
2015-07-29 21:13:36 +02:00
|
|
|
consensus.hashGenesisBlock = genesis.GetHash();
|
|
|
|
|
|
2016-03-26 16:13:39 -07:00
|
|
|
scriptCoinbaseDestination = CScript(); // Allow any coinbase destination
|
|
|
|
|
|
2016-04-03 11:49:36 +02:00
|
|
|
vFixedSeeds.clear(); //!< Regtest mode doesn't have any fixed seeds.
|
|
|
|
|
vSeeds.clear(); //!< Regtest mode doesn't have any DNS seeds.
|
2013-05-07 15:16:25 +02:00
|
|
|
|
2014-06-04 12:51:29 +02:00
|
|
|
fMiningRequiresPeers = false;
|
2015-03-13 09:25:34 -07:00
|
|
|
fDefaultConsistencyChecks = true;
|
2014-06-04 12:51:29 +02:00
|
|
|
fRequireStandard = false;
|
|
|
|
|
fMineBlocksOnDemand = true;
|
2014-08-31 22:32:52 +02:00
|
|
|
fTestnetToBeDeprecatedFieldRPC = false;
|
2015-04-23 18:30:55 -04:00
|
|
|
|
2015-06-05 15:36:34 -04:00
|
|
|
checkpointData = (CCheckpointData){
|
2015-04-23 18:30:55 -04:00
|
|
|
boost::assign::map_list_of
|
2015-07-01 19:02:51 +02:00
|
|
|
( 0, consensus.hashGenesisBlock),
|
2015-04-23 18:30:55 -04:00
|
|
|
0,
|
|
|
|
|
0,
|
|
|
|
|
0
|
|
|
|
|
};
|
2015-07-03 14:30:18 +02:00
|
|
|
base58Prefixes[PUBKEY_ADDRESS] = std::vector<unsigned char>(1,111);
|
|
|
|
|
base58Prefixes[SCRIPT_ADDRESS] = std::vector<unsigned char>(1,196);
|
2016-02-29 13:44:46 -05:00
|
|
|
base58Prefixes[BLINDED_ADDRESS]= std::vector<unsigned char>(1,27);
|
2015-07-03 14:30:18 +02:00
|
|
|
base58Prefixes[SECRET_KEY] = std::vector<unsigned char>(1,239);
|
|
|
|
|
base58Prefixes[EXT_PUBLIC_KEY] = boost::assign::list_of(0x04)(0x35)(0x87)(0xCF).convert_to_container<std::vector<unsigned char> >();
|
|
|
|
|
base58Prefixes[EXT_SECRET_KEY] = boost::assign::list_of(0x04)(0x35)(0x83)(0x94).convert_to_container<std::vector<unsigned char> >();
|
2014-08-31 21:32:23 +02:00
|
|
|
}
|
2016-07-25 17:22:37 -04:00
|
|
|
|
|
|
|
|
void UpdateBIP9Parameters(Consensus::DeploymentPos d, int64_t nStartTime, int64_t nTimeout)
|
|
|
|
|
{
|
|
|
|
|
consensus.vDeployments[d].nStartTime = nStartTime;
|
|
|
|
|
consensus.vDeployments[d].nTimeout = nTimeout;
|
|
|
|
|
}
|
2013-05-07 15:16:25 +02:00
|
|
|
};
|
|
|
|
|
|
2016-02-08 16:04:37 -08:00
|
|
|
const std::map<std::string, uint256> CChainParams::supportedChains =
|
|
|
|
|
boost::assign::map_list_of
|
|
|
|
|
( CHAINPARAMS_ELEMENTS, CElementsParams().GenesisBlock().GetHash())
|
|
|
|
|
( CHAINPARAMS_REGTEST, CRegTestParams().GenesisBlock().GetHash())
|
|
|
|
|
;
|
|
|
|
|
|
2015-05-22 03:50:01 +02:00
|
|
|
static boost::scoped_ptr<CChainParams> globalChainParams;
|
2013-05-07 15:16:25 +02:00
|
|
|
|
|
|
|
|
const CChainParams &Params() {
|
2015-05-22 03:50:01 +02:00
|
|
|
assert(globalChainParams.get());
|
|
|
|
|
return *globalChainParams;
|
2013-05-07 15:16:25 +02:00
|
|
|
}
|
|
|
|
|
|
2015-05-22 03:50:01 +02:00
|
|
|
CChainParams* CChainParams::Factory(const std::string& chain)
|
2015-06-30 21:39:49 +02:00
|
|
|
{
|
|
|
|
|
if (chain == CBaseChainParams::MAIN)
|
2015-05-22 03:50:01 +02:00
|
|
|
return new CMainParams();
|
2015-11-17 02:38:31 +01:00
|
|
|
else if (chain == CHAINPARAMS_ELEMENTS)
|
|
|
|
|
return new CElementsParams();
|
2015-06-30 21:39:49 +02:00
|
|
|
else if (chain == CBaseChainParams::REGTEST)
|
2015-05-22 03:50:01 +02:00
|
|
|
return new CRegTestParams();
|
2015-06-30 21:39:49 +02:00
|
|
|
else
|
|
|
|
|
throw std::runtime_error(strprintf("%s: Unknown chain %s.", __func__, chain));
|
2013-05-07 15:16:25 +02:00
|
|
|
}
|
|
|
|
|
|
2015-06-30 21:39:49 +02:00
|
|
|
void SelectParams(const std::string& network)
|
|
|
|
|
{
|
2014-08-02 19:54:57 +01:00
|
|
|
SelectBaseParams(network);
|
2015-05-22 03:50:01 +02:00
|
|
|
globalChainParams.reset(CChainParams::Factory(network));
|
2014-08-02 19:54:57 +01:00
|
|
|
}
|
2016-07-25 17:22:37 -04:00
|
|
|
|
|
|
|
|
void UpdateRegtestBIP9Parameters(Consensus::DeploymentPos d, int64_t nStartTime, int64_t nTimeout)
|
|
|
|
|
{
|
2015-05-22 03:50:01 +02:00
|
|
|
assert(globalChainParams.get());
|
|
|
|
|
(*globalChainParams).UpdateBIP9Parameters(d, nStartTime, nTimeout);
|
2016-07-25 17:22:37 -04:00
|
|
|
}
|
2015-11-06 01:42:38 +01:00
|
|
|
|