Fix genesis block creation

This commit is contained in:
Matt Corallo 2016-03-18 21:39:01 -07:00 committed by Gregory Sanders
parent 40a12f6c68
commit 832e8f9a12

View file

@ -17,7 +17,7 @@
#include "chainparamsseeds.h"
static CBlock CreateGenesisBlock(const char* pszTimestamp, const CScript& genesisOutputScript, uint32_t nTime, uint32_t nNonce, uint32_t nBits, int32_t nVersion, const CAmount& genesisReward)
static CBlock CreateGenesisBlock(const char* pszTimestamp, const CScript& genesisOutputScript, uint32_t nTime, const CScript& scriptChallenge, int32_t nVersion, const CAmount& genesisReward)
{
CMutableTransaction txNew;
txNew.nVersion = 1;
@ -29,7 +29,7 @@ static CBlock CreateGenesisBlock(const char* pszTimestamp, const CScript& genesi
CBlock genesis;
genesis.nTime = nTime;
genesis.proof = CProof(nBits, nNonce);
genesis.proof = CProof(scriptChallenge, CScript());
genesis.nVersion = nVersion;
genesis.vtx.push_back(txNew);
genesis.hashPrevBlock.SetNull();
@ -83,8 +83,11 @@ public:
nDefaultPort = 9042;
nPruneAfterHeight = 100000;
CScript scriptDestination(CScript() << OP_1 << ParseHex("03aeb681df5ac19e449a872b9e9347f1db5a0394d2ec5caf2a9c143f86e232b0d9") << OP_1 << OP_CHECKMULTISIG);
genesis = CreateGenesisBlock(strNetworkID.c_str(), scriptDestination, 1231006505, 2083236893, 0x1d00ffff, 1, MAX_MONEY);
CScript scriptChallenge(CScript() << OP_1 << ParseHex("03aeb681df5ac19e449a872b9e9347f1db5a0394d2ec5caf2a9c143f86e232b0d9") << OP_1 << OP_CHECKMULTISIG);
uint256 genesisBlockHash(uint256S("000000000933ea01ad0ee984209779baaec3ced90fa3f408719526f8d77f4943"));
CScript scriptDestination(CScript() << std::vector<unsigned char>(genesisBlockHash.begin(), genesisBlockHash.end()) << OP_WITHDRAWPROOFVERIFY);
genesis = CreateGenesisBlock(strNetworkID.c_str(), scriptDestination, 1231006505, scriptChallenge, 1, MAX_MONEY);
consensus.hashGenesisBlock = genesis.GetHash();
vFixedSeeds.clear(); //! TODO
@ -167,7 +170,7 @@ public:
nPruneAfterHeight = 1000;
CScript scriptDestination(CScript() << OP_TRUE);
genesis = CreateGenesisBlock(strNetworkID.c_str(), scriptDestination, 1296688602, 2, 0x207fffff, 1, MAX_MONEY);
genesis = CreateGenesisBlock(strNetworkID.c_str(), scriptDestination, 1296688602, scriptDestination, 1, MAX_MONEY);
consensus.hashGenesisBlock = genesis.GetHash();
vFixedSeeds.clear(); //!< Regtest mode doesn't have any fixed seeds.