mirror of
https://github.com/ElementsProject/elements.git
synced 2026-08-19 13:27:35 +02:00
Set genesis block CProof to signblockscript if signed blocks active
This commit is contained in:
parent
6ad13bbbe6
commit
2a3dcde9ac
1 changed files with 11 additions and 8 deletions
|
|
@ -30,7 +30,7 @@ static std::vector<unsigned char> CommitToArguments(const Consensus::Params& par
|
||||||
return std::vector<unsigned char>(commitment, commitment + 32);
|
return std::vector<unsigned char>(commitment, commitment + 32);
|
||||||
}
|
}
|
||||||
|
|
||||||
static CBlock CreateGenesisBlock(const CScript& genesisScriptSig, const CScript& genesisOutputScript, uint32_t nTime, uint32_t nNonce, uint32_t nBits, int32_t nVersion, const CAmount& genesisReward)
|
static CBlock CreateGenesisBlock(const Consensus::Params& params, const CScript& genesisScriptSig, const CScript& genesisOutputScript, uint32_t nTime, uint32_t nNonce, uint32_t nBits, int32_t nVersion, const CAmount& genesisReward)
|
||||||
{
|
{
|
||||||
CMutableTransaction txNew;
|
CMutableTransaction txNew;
|
||||||
txNew.nVersion = 1;
|
txNew.nVersion = 1;
|
||||||
|
|
@ -48,6 +48,9 @@ static CBlock CreateGenesisBlock(const CScript& genesisScriptSig, const CScript&
|
||||||
genesis.vtx.push_back(MakeTransactionRef(std::move(txNew)));
|
genesis.vtx.push_back(MakeTransactionRef(std::move(txNew)));
|
||||||
genesis.hashPrevBlock.SetNull();
|
genesis.hashPrevBlock.SetNull();
|
||||||
genesis.hashMerkleRoot = BlockMerkleRoot(genesis);
|
genesis.hashMerkleRoot = BlockMerkleRoot(genesis);
|
||||||
|
if (g_signed_blocks) {
|
||||||
|
genesis.proof = CProof(params.signblockscript, CScript());
|
||||||
|
}
|
||||||
return genesis;
|
return genesis;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -62,12 +65,12 @@ static CBlock CreateGenesisBlock(const CScript& genesisScriptSig, const CScript&
|
||||||
* CTxOut(nValue=50.00000000, scriptPubKey=0x5F1DF16B2B704C8A578D0B)
|
* CTxOut(nValue=50.00000000, scriptPubKey=0x5F1DF16B2B704C8A578D0B)
|
||||||
* vMerkleTree: 4a5e1e
|
* vMerkleTree: 4a5e1e
|
||||||
*/
|
*/
|
||||||
static CBlock CreateGenesisBlock(uint32_t nTime, uint32_t nNonce, uint32_t nBits, int32_t nVersion, const CAmount& genesisReward)
|
static CBlock CreateGenesisBlock(uint32_t nTime, uint32_t nNonce, uint32_t nBits, int32_t nVersion, const CAmount& genesisReward, const Consensus::Params& params)
|
||||||
{
|
{
|
||||||
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";
|
||||||
const CScript genesisScriptSig = CScript() << 486604799 << CScriptNum(4) << std::vector<unsigned char>((const unsigned char*)pszTimestamp, (const unsigned char*)pszTimestamp + strlen(pszTimestamp));
|
const CScript genesisScriptSig = CScript() << 486604799 << CScriptNum(4) << std::vector<unsigned char>((const unsigned char*)pszTimestamp, (const unsigned char*)pszTimestamp + strlen(pszTimestamp));
|
||||||
const CScript genesisOutputScript = CScript() << ParseHex("04678afdb0fe5548271967f1a67130b7105cd6a828e03909a67962e0ea1f61deb649f6bc3f4cef38c4f35504e51ec112de5c384df7ba0b8d578a4c702b6bf11d5f") << OP_CHECKSIG;
|
const CScript genesisOutputScript = CScript() << ParseHex("04678afdb0fe5548271967f1a67130b7105cd6a828e03909a67962e0ea1f61deb649f6bc3f4cef38c4f35504e51ec112de5c384df7ba0b8d578a4c702b6bf11d5f") << OP_CHECKSIG;
|
||||||
return CreateGenesisBlock(genesisScriptSig, genesisOutputScript, nTime, nNonce, nBits, nVersion, genesisReward);
|
return CreateGenesisBlock(params, genesisScriptSig, genesisOutputScript, nTime, nNonce, nBits, nVersion, genesisReward);
|
||||||
}
|
}
|
||||||
|
|
||||||
/** Add an issuance transaction to the genesis block. Typically used to pre-issue
|
/** Add an issuance transaction to the genesis block. Typically used to pre-issue
|
||||||
|
|
@ -151,7 +154,7 @@ public:
|
||||||
nDefaultPort = 8333;
|
nDefaultPort = 8333;
|
||||||
nPruneAfterHeight = 100000;
|
nPruneAfterHeight = 100000;
|
||||||
|
|
||||||
genesis = CreateGenesisBlock(1231006505, 2083236893, 0x1d00ffff, 1, 50 * COIN);
|
genesis = CreateGenesisBlock(1231006505, 2083236893, 0x1d00ffff, 1, 50 * COIN, consensus);
|
||||||
consensus.hashGenesisBlock = genesis.GetHash();
|
consensus.hashGenesisBlock = genesis.GetHash();
|
||||||
assert(consensus.hashGenesisBlock == uint256S("0x000000000019d6689c085ae165831e934ff763ae46a2a6c172b3f1b60a8ce26f"));
|
assert(consensus.hashGenesisBlock == uint256S("0x000000000019d6689c085ae165831e934ff763ae46a2a6c172b3f1b60a8ce26f"));
|
||||||
assert(genesis.hashMerkleRoot == uint256S("0x4a5e1e4baab89f3a32518a88c31bc87f618f76673e2cc77ab2127b7afdeda33b"));
|
assert(genesis.hashMerkleRoot == uint256S("0x4a5e1e4baab89f3a32518a88c31bc87f618f76673e2cc77ab2127b7afdeda33b"));
|
||||||
|
|
@ -264,7 +267,7 @@ public:
|
||||||
nDefaultPort = 18333;
|
nDefaultPort = 18333;
|
||||||
nPruneAfterHeight = 1000;
|
nPruneAfterHeight = 1000;
|
||||||
|
|
||||||
genesis = CreateGenesisBlock(1296688602, 414098458, 0x1d00ffff, 1, 50 * COIN);
|
genesis = CreateGenesisBlock(1296688602, 414098458, 0x1d00ffff, 1, 50 * COIN, consensus);
|
||||||
consensus.hashGenesisBlock = genesis.GetHash();
|
consensus.hashGenesisBlock = genesis.GetHash();
|
||||||
assert(consensus.hashGenesisBlock == uint256S("0x000000000933ea01ad0ee984209779baaec3ced90fa3f408719526f8d77f4943"));
|
assert(consensus.hashGenesisBlock == uint256S("0x000000000933ea01ad0ee984209779baaec3ced90fa3f408719526f8d77f4943"));
|
||||||
assert(genesis.hashMerkleRoot == uint256S("0x4a5e1e4baab89f3a32518a88c31bc87f618f76673e2cc77ab2127b7afdeda33b"));
|
assert(genesis.hashMerkleRoot == uint256S("0x4a5e1e4baab89f3a32518a88c31bc87f618f76673e2cc77ab2127b7afdeda33b"));
|
||||||
|
|
@ -359,7 +362,7 @@ public:
|
||||||
|
|
||||||
UpdateVersionBitsParametersFromArgs(args);
|
UpdateVersionBitsParametersFromArgs(args);
|
||||||
|
|
||||||
genesis = CreateGenesisBlock(1296688602, 2, 0x207fffff, 1, 50 * COIN);
|
genesis = CreateGenesisBlock(1296688602, 2, 0x207fffff, 1, 50 * COIN, consensus);
|
||||||
consensus.hashGenesisBlock = genesis.GetHash();
|
consensus.hashGenesisBlock = genesis.GetHash();
|
||||||
assert(consensus.hashGenesisBlock == uint256S("0x0f9188f13cb7b2c71f2a335e3a4fc328bf5beb436012afca590b1a11466e2206"));
|
assert(consensus.hashGenesisBlock == uint256S("0x0f9188f13cb7b2c71f2a335e3a4fc328bf5beb436012afca590b1a11466e2206"));
|
||||||
assert(genesis.hashMerkleRoot == uint256S("0x4a5e1e4baab89f3a32518a88c31bc87f618f76673e2cc77ab2127b7afdeda33b"));
|
assert(genesis.hashMerkleRoot == uint256S("0x4a5e1e4baab89f3a32518a88c31bc87f618f76673e2cc77ab2127b7afdeda33b"));
|
||||||
|
|
@ -525,11 +528,11 @@ class CCustomParams : public CRegTestParams {
|
||||||
void SetGenesisBlock() {
|
void SetGenesisBlock() {
|
||||||
if (consensus.genesis_style == "bitcoin") {
|
if (consensus.genesis_style == "bitcoin") {
|
||||||
// For compatibility with bitcoin (regtest)
|
// For compatibility with bitcoin (regtest)
|
||||||
genesis = CreateGenesisBlock(1296688602, 2, 0x207fffff, 1, 50 * COIN);
|
genesis = CreateGenesisBlock(1296688602, 2, 0x207fffff, 1, 50 * COIN, consensus);
|
||||||
} else if (consensus.genesis_style == "elements") {
|
} else if (consensus.genesis_style == "elements") {
|
||||||
// Intended compatibility with Liquid v1 and elements-0.14.1
|
// Intended compatibility with Liquid v1 and elements-0.14.1
|
||||||
std::vector<unsigned char> commit = CommitToArguments(consensus, strNetworkID);
|
std::vector<unsigned char> commit = CommitToArguments(consensus, strNetworkID);
|
||||||
genesis = CreateGenesisBlock(CScript(commit), CScript(OP_RETURN), 1296688602, 2, 0x207fffff, 1, 0);
|
genesis = CreateGenesisBlock(consensus, CScript(commit), CScript(OP_RETURN), 1296688602, 2, 0x207fffff, 1, 0);
|
||||||
if (initialFreeCoins != 0) {
|
if (initialFreeCoins != 0) {
|
||||||
AppendInitialIssuance(genesis, COutPoint(uint256(commit), 0), initialFreeCoins, CScript() << OP_TRUE);
|
AppendInitialIssuance(genesis, COutPoint(uint256(commit), 0), initialFreeCoins, CScript() << OP_TRUE);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue