mirror of
https://github.com/jwinterm/myriadcoin.git
synced 2026-10-20 06:08:43 +02:00
Myriadcoin 0.11 port
This commit is contained in:
+321
-125
@@ -1,68 +1,154 @@
|
||||
// Copyright (c) 2010 Satoshi Nakamoto
|
||||
// Copyright (c) 2009-2014 The Bitcoin developers
|
||||
// Distributed under the MIT/X11 software license, see the accompanying
|
||||
// Copyright (c) 2009-2014 The Bitcoin Core developers
|
||||
// Distributed under the MIT software license, see the accompanying
|
||||
// file COPYING or http://www.opensource.org/licenses/mit-license.php.
|
||||
|
||||
#include "arith_uint256.h"
|
||||
#include "tinyformat.h"
|
||||
#include "chainparams.h"
|
||||
|
||||
#include "assert.h"
|
||||
#include "core.h"
|
||||
#include "protocol.h"
|
||||
#include <stdio.h>
|
||||
#include "util.h"
|
||||
#include "utilstrencodings.h"
|
||||
|
||||
#include <assert.h>
|
||||
|
||||
#include <boost/assign/list_of.hpp>
|
||||
|
||||
using namespace boost::assign;
|
||||
using namespace std;
|
||||
|
||||
//
|
||||
// Main network
|
||||
//
|
||||
#include "chainparamsseeds.h"
|
||||
|
||||
unsigned int pnSeed[] =
|
||||
{
|
||||
0x12345678
|
||||
};
|
||||
/**
|
||||
* Main network
|
||||
*/
|
||||
/**
|
||||
* What makes a good checkpoint block?
|
||||
* + Is surrounded by blocks with reasonable timestamps
|
||||
* (no blocks before with a timestamp after, none after with
|
||||
* timestamp before)
|
||||
* + Contains no strange transactions
|
||||
*/
|
||||
|
||||
class CMainParams : public CChainParams {
|
||||
public:
|
||||
CMainParams() {
|
||||
// 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
|
||||
// a large 4-byte int at any alignment.
|
||||
strNetworkID = "main";
|
||||
consensus.nSubsidyHalvingInterval = 80640 * 12;
|
||||
consensus.nMajorityEnforceBlockUpgrade = 750;
|
||||
consensus.nMajorityRejectBlockOutdated = 950;
|
||||
consensus.nMajorityWindow = 1000;
|
||||
consensus.powLimit = ArithToUint256(~arith_uint256(0) >> 20);
|
||||
consensus.nPowTargetTimespan = 14 * 24 * 60 * 60; // two weeks
|
||||
consensus.nPowTargetSpacingV1 = 30; // target time for block spacing across all algorithms
|
||||
consensus.nPowTargetSpacingV2 = 60; // new target time for block spacing across all algorithms
|
||||
consensus.nAveragingInterval = 10; // number of blocks to take the timespan of
|
||||
consensus.fPowAllowMinDifficultyBlocks = false;
|
||||
|
||||
// Allow AuxPow blocks from this height
|
||||
consensus.nStartAuxPow = 1402000;
|
||||
consensus.nAuxpowChainId = 0x005A;
|
||||
consensus.fStrictChainId = false;
|
||||
|
||||
consensus.nBlockTimeWarpPreventStart1 = 740500; // block where time warp 1 prevention starts
|
||||
consensus.nBlockTimeWarpPreventStart2 = 766000; // block where time warp 2 prevention starts
|
||||
consensus.nBlockTimeWarpPreventStart3 = 1048320; // block where time warp 3 prevention starts
|
||||
consensus.Phase2Timespan_Start = 1401000; // block where 60 second target time kicks in
|
||||
consensus.nBlockDiffAdjustV2 = 766000; // block where difficulty adjust V2 starts
|
||||
|
||||
consensus.nMaxAdjustDown = 4; // 4% adjustment down
|
||||
consensus.nMaxAdjustUpV1 = 2; // 2% adjustment up
|
||||
consensus.nMaxAdjustUpV2 = 4; // 4% adjustment up
|
||||
|
||||
consensus.nBlockSequentialAlgoRuleStart1 = 740000; // block where sequential algo rule starts
|
||||
consensus.nBlockSequentialAlgoRuleStart2 = 766000; // block where sequential algo rule starts
|
||||
consensus.nBlockSequentialAlgoMaxCount1 = 6; // maximum sequential blocks of same algo
|
||||
consensus.nBlockSequentialAlgoMaxCount2 = 3; // maximum sequential blocks of same algo
|
||||
|
||||
consensus.nBlockAlgoWorkWeightStart = 142000; // block where algo work weighting starts
|
||||
consensus.nBlockAlgoNormalisedWorkStart = 740000; // block where algo combined weight starts
|
||||
consensus.nBlockAlgoNormalisedWorkDecayStart1 = 866000; // block where weight decay starts
|
||||
consensus.nBlockAlgoNormalisedWorkDecayStart2 = 932000; // block where weight decay starts
|
||||
consensus.nGeoAvgWork_Start = 1400000;
|
||||
|
||||
/**
|
||||
* 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
|
||||
* a large 32-bit integer with any alignment.
|
||||
*/
|
||||
pchMessageStart[0] = 0xaf;
|
||||
pchMessageStart[1] = 0x45;
|
||||
pchMessageStart[2] = 0x76;
|
||||
pchMessageStart[3] = 0xee;
|
||||
vAlertPubKey = ParseHex("04a82e43bebee0af77bb6d4f830c5b2095b7479a480e91bbbf3547fb261c5e6d1be2c27e3c57503f501480f5027371ec62b2be1b6f00fc746e4b3777259e7f6a78");
|
||||
nDefaultPort = 10888;
|
||||
nRPCPort = 10889;
|
||||
bnProofOfWorkLimit[ALGO_SHA256D] = CBigNum(~uint256(0) >> 20);
|
||||
bnProofOfWorkLimit[ALGO_SCRYPT] = CBigNum(~uint256(0) >> 20);
|
||||
bnProofOfWorkLimit[ALGO_GROESTL] = CBigNum(~uint256(0) >> 20);
|
||||
bnProofOfWorkLimit[ALGO_SKEIN] = CBigNum(~uint256(0) >> 20);
|
||||
bnProofOfWorkLimit[ALGO_QUBIT] = CBigNum(~uint256(0) >> 20);
|
||||
nSubsidyHalvingInterval = 80640 * 12;
|
||||
nMinerThreads = 0;
|
||||
nPruneAfterHeight = 100000;
|
||||
|
||||
// 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 its generation
|
||||
* transaction cannot be spent since 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)
|
||||
* CTxIn(COutPoint(000000, -1), coinbase 04ffff001d0104455468652054696d65732030332f4a616e2f32303039204368616e63656c6c6f72206f6e206272696e6b206f66207365636f6e64206261696c6f757420666f722062616e6b73)
|
||||
* CTxOut(nValue=50.00000000, scriptPubKey=0x5F1DF16B2B704C8A578D0B)
|
||||
* vMerkleTree: 4a5e1e
|
||||
*/
|
||||
const char* pszTimestamp = "2014-02-23 FT - G20 aims to add $2tn to global economy";
|
||||
CTransaction txNew;
|
||||
CMutableTransaction txNew;
|
||||
txNew.vin.resize(1);
|
||||
txNew.vout.resize(1);
|
||||
txNew.vin[0].scriptSig = CScript() << 486604799 << CBigNum(4) << vector<unsigned char>((const unsigned char*)pszTimestamp, (const unsigned char*)pszTimestamp + strlen(pszTimestamp));
|
||||
txNew.vin[0].scriptSig = CScript() << 486604799 << CScriptNum(4) << vector<unsigned char>((const unsigned char*)pszTimestamp, (const unsigned char*)pszTimestamp + strlen(pszTimestamp));
|
||||
txNew.vout[0].nValue = 1000 * COIN;
|
||||
txNew.vout[0].scriptPubKey = CScript() << ParseHex("04e941763c7750969e751bee1ffbe96a651a0feb131db046546c219ea40bff40b95077dc9ba1c05af991588772d8daabbda57386c068fb9bc7477c5e28702d5eb9") << OP_CHECKSIG;
|
||||
genesis.vtx.push_back(txNew);
|
||||
genesis.hashPrevBlock = 0;
|
||||
genesis.hashPrevBlock.SetNull();
|
||||
genesis.hashMerkleRoot = genesis.BuildMerkleTree();
|
||||
genesis.nVersion = BLOCK_VERSION_DEFAULT;
|
||||
genesis.nVersion = 2;
|
||||
genesis.nTime = 1393164995;
|
||||
genesis.nBits = 0x1e0fffff;
|
||||
genesis.nNonce = 2092903596;
|
||||
|
||||
hashGenesisBlock = genesis.GetHash();
|
||||
assert(hashGenesisBlock == uint256("0x00000ffde4c020b5938441a0ea3d314bf619eff0b38f32f78f7583cffa1ea485"));
|
||||
assert(genesis.hashMerkleRoot == uint256("0x3f75db3c18e92f46c21530dc1222e1fddf4ccebbf88e289a6c9dc787fd6469da"));
|
||||
consensus.hashGenesisBlock = genesis.GetHash();
|
||||
|
||||
// If genesis block hash does not match, then generate new genesis hash.
|
||||
|
||||
uint256 tmphashGenesisBlock = uint256S("0x00000ffde4c020b5938441a0ea3d314bf619eff0b38f32f78f7583cffa1ea485");
|
||||
if (true && genesis.GetHash() != tmphashGenesisBlock)
|
||||
{
|
||||
printf("Searching for genesis block...\n");
|
||||
bool fNegative;
|
||||
bool fOverflow;
|
||||
arith_uint256 bnTarget;
|
||||
bnTarget.SetCompact(genesis.nBits, &fNegative, &fOverflow);
|
||||
int algo = genesis.GetAlgo();
|
||||
uint256 thash = genesis.GetPoWHash(algo);
|
||||
|
||||
while (UintToArith256(thash) > bnTarget)
|
||||
{
|
||||
thash = genesis.GetPoWHash(algo);
|
||||
if (UintToArith256(thash) <= bnTarget)
|
||||
break;
|
||||
if ((genesis.nNonce & 0xFFFFF) == 0)
|
||||
{
|
||||
printf("nonce %08X: PoWhash = %s (target = %s)\n", genesis.nNonce, thash.ToString().c_str(), bnTarget.ToString().c_str());
|
||||
}
|
||||
++genesis.nNonce;
|
||||
if (genesis.nNonce == 0)
|
||||
{
|
||||
printf("NONCE WRAPPED, incrementing time\n");
|
||||
++genesis.nTime;
|
||||
}
|
||||
}
|
||||
printf("genesis.nTime = %u \n", genesis.nTime);
|
||||
printf("genesis.nNonce = %u \n", genesis.nNonce);
|
||||
printf("genesis.GetHash = %s\n", genesis.GetHash().ToString().c_str());
|
||||
printf("genesis.GetPoWHash = %s\n", genesis.GetPoWHash(algo).ToString().c_str());
|
||||
printf("genesis.hashMerkleRoot = %s\n", genesis.BuildMerkleTree().ToString().c_str());
|
||||
}
|
||||
|
||||
assert(consensus.hashGenesisBlock == uint256S("0x00000ffde4c020b5938441a0ea3d314bf619eff0b38f32f78f7583cffa1ea485"));
|
||||
assert(genesis.hashMerkleRoot == uint256S("0x3f75db3c18e92f46c21530dc1222e1fddf4ccebbf88e289a6c9dc787fd6469da"));
|
||||
|
||||
vSeeds.push_back(CDNSSeedData("seed1.myriadcoin.org", "seed1.myriadcoin.org"));
|
||||
vSeeds.push_back(CDNSSeedData("seed2.myriadcoin.org", "seed2.myriadcoin.org"));
|
||||
@@ -73,153 +159,263 @@ public:
|
||||
vSeeds.push_back(CDNSSeedData("seed7.myriadcoin.org", "seed7.myriadcoin.org"));
|
||||
vSeeds.push_back(CDNSSeedData("seed8.myriadcoin.org", "seed8.myriadcoin.org"));
|
||||
|
||||
base58Prefixes[PUBKEY_ADDRESS] = list_of(50);
|
||||
base58Prefixes[SCRIPT_ADDRESS] = list_of(9);
|
||||
base58Prefixes[SECRET_KEY] = list_of(178);
|
||||
base58Prefixes[EXT_PUBLIC_KEY] = list_of(0x04)(0x88)(0xB2)(0x1E);
|
||||
base58Prefixes[EXT_SECRET_KEY] = list_of(0x04)(0x88)(0xAD)(0xE4);
|
||||
base58Prefixes[PUBKEY_ADDRESS] = std::vector<unsigned char>(1,50);
|
||||
base58Prefixes[SCRIPT_ADDRESS] = std::vector<unsigned char>(1,9);
|
||||
base58Prefixes[SECRET_KEY] = std::vector<unsigned char>(1,178);
|
||||
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> >();
|
||||
|
||||
// Convert the pnSeeds array into usable address objects.
|
||||
for (unsigned int i = 0; i < ARRAYLEN(pnSeed); i++)
|
||||
{
|
||||
// It'll only connect to one or two seed nodes because once it connects,
|
||||
// it'll get a pile of addresses with newer timestamps.
|
||||
// Seed nodes are given a random 'last seen time' of between one and two
|
||||
// weeks ago.
|
||||
const int64_t nOneWeek = 7*24*60*60;
|
||||
struct in_addr ip;
|
||||
memcpy(&ip, &pnSeed[i], sizeof(ip));
|
||||
CAddress addr(CService(ip, GetDefaultPort()));
|
||||
addr.nTime = GetTime() - GetRand(nOneWeek) - nOneWeek;
|
||||
vFixedSeeds.push_back(addr);
|
||||
}
|
||||
vFixedSeeds = std::vector<SeedSpec6>(pnSeed6_main, pnSeed6_main + ARRAYLEN(pnSeed6_main));
|
||||
|
||||
fRequireRPCPassword = true;
|
||||
fMiningRequiresPeers = true;
|
||||
fDefaultConsistencyChecks = false;
|
||||
fRequireStandard = true;
|
||||
fMineBlocksOnDemand = false;
|
||||
fTestnetToBeDeprecatedFieldRPC = false;
|
||||
|
||||
checkpointData = (Checkpoints::CCheckpointData) {
|
||||
boost::assign::map_list_of
|
||||
( 0, uint256S("0x00000ffde4c020b5938441a0ea3d314bf619eff0b38f32f78f7583cffa1ea485"))
|
||||
( 9646, uint256S("0x0000000000000b0f1372211861f226a3ec06a27d0a5bf36e4244a982da077e8f"))
|
||||
( 27255, uint256S("0x00000000000005112a0debf53703eb3dc4ec2d8d68599c90db71423ea14489b7"))
|
||||
( 70623, uint256S("0x00000000000004767ff6e509d00772af5c4bedaa82c38c1e95c33adbf5ff84f5"))
|
||||
( 112567, uint256S("0x000000000000018c0621bf32ab33d3ca871509f406f08be6dd20facea747b099"))
|
||||
( 141845, uint256S("0x00000000000000f62d14d55c2bc3ec0ba94e4f2b3868bbe7be9cb5b681fcc0fb"))
|
||||
( 149540, uint256S("0x000000000000061b8f5b8653fe13b5e453347d9386d43d09445ee5e26a8222bb"))
|
||||
( 348178, uint256S("0x0000000000000a410c6aff939087769e757132098fa0b0ce89f11d68f935077d"))
|
||||
( 431747, uint256S("0x000000000000065616abeccd681f7b4d6d7bed06deef0e1a6e70c905edae3692"))
|
||||
( 490168, uint256S("0x000000000000155ce9845e501617f152127e32c2c468edc643809f9988d30327"))
|
||||
( 557719, uint256S("0x0000000000000851f690d42129b34408697c88316879debd413049959517d7c6"))
|
||||
( 740001, uint256S("0x00000000000002c7aaa3ad688eb5af7d2779f4aa1d9a1b9a5c3cfb4ccad56caa"))
|
||||
( 740576, uint256S("0x00000000000043dc047538e724f17a388146f22dd2ecf66f3c88253799912f4d"))
|
||||
( 766081, uint256S("0x00000000000001e604a7acc2dd539ff8bd51224a7aac8647736d1af10160427d"))
|
||||
(1007712, uint256S("0x00000000000013e0fb1ec8ba2ce0b04b1547d9ae7d9c9e5a2691aeca87559a12"))
|
||||
(1077647, uint256S("0x00000000000038b85361a79dd4a04b1f01ec2cc60f4176185363aa4522aab12d"))
|
||||
(1177283, uint256S("0x000000000000359b1fb371d92db45de64b449ea72863a51fa78fea6b7ff3989f"))
|
||||
(1336174, uint256S("0x00000000000001eafb1051fda69eb842577a0e48e4f0682bd7f33677373d0807"))
|
||||
(1402167, uint256S("0x8215cd9feb2db9bf74514361a9d4b4440f054101079df8bb6bf629065db3ab29"))
|
||||
(1449500, uint256S("0xef19939e314f239999b9959ac908b20a43b165719d1c35dcfe38ba2566d20765")),
|
||||
1446851338, // * UNIX timestamp of last checkpoint block
|
||||
4117140, // * total number of transactions between genesis and last checkpoint
|
||||
// (the tx=... number in the SetBestChain debug.log lines)
|
||||
2880 // * estimated number of transactions per day after checkpoint
|
||||
};
|
||||
}
|
||||
|
||||
virtual const CBlock& GenesisBlock() const { return genesis; }
|
||||
virtual Network NetworkID() const { return CChainParams::MAIN; }
|
||||
|
||||
virtual const vector<CAddress>& FixedSeeds() const {
|
||||
return vFixedSeeds;
|
||||
}
|
||||
protected:
|
||||
CBlock genesis;
|
||||
vector<CAddress> vFixedSeeds;
|
||||
};
|
||||
static CMainParams mainParams;
|
||||
|
||||
|
||||
//
|
||||
// Testnet (v3)
|
||||
//
|
||||
/**
|
||||
* Testnet (v3)
|
||||
*/
|
||||
class CTestNetParams : public CMainParams {
|
||||
public:
|
||||
CTestNetParams() {
|
||||
// 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
|
||||
// a large 4-byte int at any alignment.
|
||||
strNetworkID = "test";
|
||||
consensus.nMajorityEnforceBlockUpgrade = 51;
|
||||
consensus.nMajorityRejectBlockOutdated = 75;
|
||||
consensus.nMajorityWindow = 100;
|
||||
consensus.fPowAllowMinDifficultyBlocks = true;
|
||||
pchMessageStart[0] = 0x01;
|
||||
pchMessageStart[1] = 0xf5;
|
||||
pchMessageStart[2] = 0x55;
|
||||
pchMessageStart[3] = 0xa4;
|
||||
vAlertPubKey = ParseHex("044adf046e6bc86fb83ef92f261fa3feff9176bd029c5ad4afb5c52ac21f9851f2b2eb861cdbf2c09e0cb97dbf75c6ca5ff6c5df88cfb244c72dba1d44b5a47655");
|
||||
nDefaultPort = 20888;
|
||||
nRPCPort = 20889;
|
||||
strDataDir = "testnet";
|
||||
nMinerThreads = 0;
|
||||
nPruneAfterHeight = 1000;
|
||||
|
||||
// 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 = 1392876393;
|
||||
genesis.nNonce = 416875379;
|
||||
hashGenesisBlock = genesis.GetHash();
|
||||
assert(hashGenesisBlock == uint256("0x0000017ce2a79c8bddafbbe47c004aa92b20678c354b34085f62b762084b9788"));
|
||||
consensus.hashGenesisBlock = genesis.GetHash();
|
||||
|
||||
// If genesis block hash does not match, then generate new genesis hash.
|
||||
|
||||
uint256 tmphashGenesisBlock = uint256S("0x0000017ce2a79c8bddafbbe47c004aa92b20678c354b34085f62b762084b9788");
|
||||
if (true && genesis.GetHash() != tmphashGenesisBlock)
|
||||
{
|
||||
printf("Searching for Testnet genesis block...\n");
|
||||
bool fNegative;
|
||||
bool fOverflow;
|
||||
arith_uint256 bnTarget;
|
||||
bnTarget.SetCompact(genesis.nBits, &fNegative, &fOverflow);
|
||||
|
||||
int algo = genesis.GetAlgo();
|
||||
uint256 thash = genesis.GetPoWHash(algo);
|
||||
|
||||
while (UintToArith256(thash) > bnTarget)
|
||||
{
|
||||
thash = genesis.GetPoWHash(algo);
|
||||
if (UintToArith256(thash) <= bnTarget)
|
||||
break;
|
||||
if ((genesis.nNonce & 0xFFFFF) == 0)
|
||||
{
|
||||
printf("nonce %08X: PoWhash = %s (target = %s)\n", genesis.nNonce, thash.ToString().c_str(), bnTarget.ToString().c_str());
|
||||
}
|
||||
++genesis.nNonce;
|
||||
if (genesis.nNonce == 0)
|
||||
{
|
||||
printf("NONCE WRAPPED, incrementing time\n");
|
||||
++genesis.nTime;
|
||||
}
|
||||
}
|
||||
printf("genesis.nTime = %u \n", genesis.nTime);
|
||||
printf("genesis.nNonce = %u \n", genesis.nNonce);
|
||||
printf("genesis.GetHash = %s\n", genesis.GetHash().ToString().c_str());
|
||||
printf("genesis.GetPoWHash = %s\n", genesis.GetPoWHash(algo).ToString().c_str());
|
||||
printf("genesis.hashMerkleRoot = %s\n", genesis.BuildMerkleTree().ToString().c_str());
|
||||
}
|
||||
|
||||
assert(consensus.hashGenesisBlock == uint256S("0x0000017ce2a79c8bddafbbe47c004aa92b20678c354b34085f62b762084b9788"));
|
||||
|
||||
vFixedSeeds.clear();
|
||||
vSeeds.clear();
|
||||
vSeeds.push_back(CDNSSeedData("testseed1.myriadcoin.org", "testseed1.myriadcoin.org"));
|
||||
|
||||
base58Prefixes[PUBKEY_ADDRESS] = list_of(88);
|
||||
base58Prefixes[SCRIPT_ADDRESS] = list_of(188);
|
||||
base58Prefixes[SECRET_KEY] = list_of(239);
|
||||
base58Prefixes[EXT_PUBLIC_KEY] = list_of(0x04)(0x35)(0x87)(0xCF);
|
||||
base58Prefixes[EXT_SECRET_KEY] = list_of(0x04)(0x35)(0x83)(0x94);
|
||||
base58Prefixes[PUBKEY_ADDRESS] = std::vector<unsigned char>(1,88);
|
||||
base58Prefixes[SCRIPT_ADDRESS] = std::vector<unsigned char>(1,188);
|
||||
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> >();
|
||||
|
||||
vFixedSeeds = std::vector<SeedSpec6>(pnSeed6_test, pnSeed6_test + ARRAYLEN(pnSeed6_test));
|
||||
|
||||
fRequireRPCPassword = true;
|
||||
fMiningRequiresPeers = true;
|
||||
fDefaultConsistencyChecks = false;
|
||||
fRequireStandard = false;
|
||||
fMineBlocksOnDemand = false;
|
||||
fTestnetToBeDeprecatedFieldRPC = true;
|
||||
|
||||
checkpointData = (Checkpoints::CCheckpointData) {
|
||||
boost::assign::map_list_of
|
||||
( 0, uint256S("0x0000017ce2a79c8bddafbbe47c004aa92b20678c354b34085f62b762084b9788")),
|
||||
1392876393,
|
||||
1,
|
||||
10
|
||||
};
|
||||
|
||||
}
|
||||
virtual Network NetworkID() const { return CChainParams::TESTNET; }
|
||||
};
|
||||
static CTestNetParams testNetParams;
|
||||
|
||||
|
||||
//
|
||||
// Regression test
|
||||
//
|
||||
/**
|
||||
* Regression test
|
||||
*/
|
||||
class CRegTestParams : public CTestNetParams {
|
||||
public:
|
||||
CRegTestParams() {
|
||||
strNetworkID = "regtest";
|
||||
consensus.nSubsidyHalvingInterval = 150;
|
||||
consensus.nMajorityEnforceBlockUpgrade = 750;
|
||||
consensus.nMajorityRejectBlockOutdated = 950;
|
||||
consensus.nMajorityWindow = 1000;
|
||||
consensus.powLimit = ArithToUint256(~arith_uint256(0) >> 1);
|
||||
pchMessageStart[0] = 0xfa;
|
||||
pchMessageStart[1] = 0x0f;
|
||||
pchMessageStart[2] = 0xa5;
|
||||
pchMessageStart[3] = 0x5a;
|
||||
nSubsidyHalvingInterval = 150;
|
||||
bnProofOfWorkLimit[ALGO_SHA256D] = CBigNum(~uint256(0) >> 1);
|
||||
bnProofOfWorkLimit[ALGO_SCRYPT] = CBigNum(~uint256(0) >> 1);
|
||||
bnProofOfWorkLimit[ALGO_GROESTL] = CBigNum(~uint256(0) >> 1);
|
||||
bnProofOfWorkLimit[ALGO_SKEIN] = CBigNum(~uint256(0) >> 1);
|
||||
bnProofOfWorkLimit[ALGO_QUBIT] = CBigNum(~uint256(0) >> 1);
|
||||
nMinerThreads = 1;
|
||||
genesis.nTime = 1296688602;
|
||||
genesis.nBits = 0x207fffff;
|
||||
genesis.nNonce = 4;
|
||||
hashGenesisBlock = genesis.GetHash();
|
||||
consensus.hashGenesisBlock = genesis.GetHash();
|
||||
nDefaultPort = 18444;
|
||||
strDataDir = "regtest";
|
||||
assert(hashGenesisBlock == uint256("0x63b92987ddc93808aa33dddc80b3e52948bdfffaf2420bf4cd9c5137b54ea37c"));
|
||||
|
||||
// If genesis block hash does not match, then generate new genesis hash.
|
||||
|
||||
uint256 tmphashGenesisBlock = uint256S("0x63b92987ddc93808aa33dddc80b3e52948bdfffaf2420bf4cd9c5137b54ea37c");
|
||||
if (true && genesis.GetHash() != tmphashGenesisBlock)
|
||||
{
|
||||
printf("Searching for Regtest genesis block...\n");
|
||||
bool fNegative;
|
||||
bool fOverflow;
|
||||
arith_uint256 bnTarget;
|
||||
bnTarget.SetCompact(genesis.nBits, &fNegative, &fOverflow);
|
||||
|
||||
int algo = genesis.GetAlgo();
|
||||
uint256 thash = genesis.GetPoWHash(algo);
|
||||
|
||||
while (UintToArith256(thash) > bnTarget)
|
||||
{
|
||||
thash = genesis.GetPoWHash(algo);
|
||||
if (UintToArith256(thash) <= bnTarget)
|
||||
break;
|
||||
if ((genesis.nNonce & 0xFFFFF) == 0)
|
||||
{
|
||||
printf("nonce %08X: PoWhash = %s (target = %s)\n", genesis.nNonce, thash.ToString().c_str(), bnTarget.ToString().c_str());
|
||||
}
|
||||
++genesis.nNonce;
|
||||
if (genesis.nNonce == 0)
|
||||
{
|
||||
printf("NONCE WRAPPED, incrementing time\n");
|
||||
++genesis.nTime;
|
||||
}
|
||||
}
|
||||
printf("genesis.nTime = %u \n", genesis.nTime);
|
||||
printf("genesis.nNonce = %u \n", genesis.nNonce);
|
||||
printf("genesis.GetHash = %s\n", genesis.GetHash().ToString().c_str());
|
||||
printf("genesis.GetPoWHash = %s\n", genesis.GetPoWHash(algo).ToString().c_str());
|
||||
printf("genesis.hashMerkleRoot = %s\n", genesis.BuildMerkleTree().ToString().c_str());
|
||||
}
|
||||
|
||||
assert(consensus.hashGenesisBlock == uint256S("0x63b92987ddc93808aa33dddc80b3e52948bdfffaf2420bf4cd9c5137b54ea37c"));
|
||||
nPruneAfterHeight = 1000;
|
||||
|
||||
vSeeds.clear(); // Regtest mode doesn't have any DNS seeds.
|
||||
vFixedSeeds.clear(); //! Regtest mode doesn't have any fixed seeds.
|
||||
vSeeds.clear(); //! Regtest mode doesn't have any DNS seeds.
|
||||
|
||||
base58Prefixes[PUBKEY_ADDRESS] = list_of(0);
|
||||
base58Prefixes[SCRIPT_ADDRESS] = list_of(5);
|
||||
base58Prefixes[SECRET_KEY] = list_of(128);
|
||||
fRequireRPCPassword = false;
|
||||
fMiningRequiresPeers = false;
|
||||
fDefaultConsistencyChecks = true;
|
||||
fRequireStandard = false;
|
||||
fMineBlocksOnDemand = true;
|
||||
fTestnetToBeDeprecatedFieldRPC = false;
|
||||
|
||||
checkpointData = (Checkpoints::CCheckpointData){
|
||||
boost::assign::map_list_of
|
||||
( 0, uint256S("0x63b92987ddc93808aa33dddc80b3e52948bdfffaf2420bf4cd9c5137b54ea37c")),
|
||||
0,
|
||||
0,
|
||||
0
|
||||
};
|
||||
}
|
||||
|
||||
virtual bool RequireRPCPassword() const { return false; }
|
||||
virtual Network NetworkID() const { return CChainParams::REGTEST; }
|
||||
};
|
||||
static CRegTestParams regTestParams;
|
||||
|
||||
static CChainParams *pCurrentParams = &mainParams;
|
||||
static CChainParams *pCurrentParams = 0;
|
||||
|
||||
const CChainParams &Params() {
|
||||
assert(pCurrentParams);
|
||||
return *pCurrentParams;
|
||||
}
|
||||
|
||||
void SelectParams(CChainParams::Network network) {
|
||||
CChainParams &Params(CBaseChainParams::Network network) {
|
||||
switch (network) {
|
||||
case CChainParams::MAIN:
|
||||
pCurrentParams = &mainParams;
|
||||
break;
|
||||
case CChainParams::TESTNET:
|
||||
pCurrentParams = &testNetParams;
|
||||
break;
|
||||
case CChainParams::REGTEST:
|
||||
pCurrentParams = ®TestParams;
|
||||
break;
|
||||
case CBaseChainParams::MAIN:
|
||||
return mainParams;
|
||||
case CBaseChainParams::TESTNET:
|
||||
return testNetParams;
|
||||
case CBaseChainParams::REGTEST:
|
||||
return regTestParams;
|
||||
default:
|
||||
assert(false && "Unimplemented network");
|
||||
return;
|
||||
return mainParams;
|
||||
}
|
||||
}
|
||||
|
||||
bool SelectParamsFromCommandLine() {
|
||||
bool fRegTest = GetBoolArg("-regtest", false);
|
||||
bool fTestNet = GetBoolArg("-testnet", false);
|
||||
void SelectParams(CBaseChainParams::Network network) {
|
||||
SelectBaseParams(network);
|
||||
pCurrentParams = &Params(network);
|
||||
}
|
||||
|
||||
if (fTestNet && fRegTest) {
|
||||
bool SelectParamsFromCommandLine()
|
||||
{
|
||||
CBaseChainParams::Network network = NetworkIdFromCommandLine();
|
||||
if (network == CBaseChainParams::MAX_NETWORK_TYPES)
|
||||
return false;
|
||||
}
|
||||
|
||||
if (fRegTest) {
|
||||
SelectParams(CChainParams::REGTEST);
|
||||
} else if (fTestNet) {
|
||||
SelectParams(CChainParams::TESTNET);
|
||||
} else {
|
||||
SelectParams(CChainParams::MAIN);
|
||||
}
|
||||
SelectParams(network);
|
||||
return true;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user