MCPcopy Create free account
hub / github.com/ElementsProject/elements / SetGenesisBlock

Method SetGenesisBlock

src/chainparams.cpp:1588–1607  ·  view source on GitHub ↗

XXX: This is copy-and-pasted from CCustomParams; sharing it would be better, but is annoying.

Source from the content-addressed store, hash-verified

1586
1587 // XXX: This is copy-and-pasted from CCustomParams; sharing it would be better, but is annoying.
1588 void SetGenesisBlock() {
1589 if (consensus.genesis_style == "bitcoin") {
1590 // For compatibility with bitcoin (regtest)
1591 genesis = CreateGenesisBlock(1296688602, 2, 0x207fffff, 1, 50 * COIN, consensus);
1592 } else if (consensus.genesis_style == "elements") {
1593 // Intended compatibility with Liquid v1 and elements-0.14.1
1594 std::vector<unsigned char> commit = CommitToArguments(consensus, strNetworkID);
1595 genesis = CreateGenesisBlock(consensus, CScript() << commit, CScript(OP_RETURN), 1296688602, 2, 0x207fffff, 1, 0);
1596 if (initialFreeCoins != 0 || initial_reissuance_tokens != 0) {
1597 AppendInitialIssuance(genesis, COutPoint(uint256(commit), 0), parentGenesisBlockHash, (initialFreeCoins > 0) ? 1 : 0, initialFreeCoins, (initial_reissuance_tokens > 0) ? 1 : 0, initial_reissuance_tokens, CScript() << OP_TRUE);
1598 }
1599 } else if (consensus.genesis_style == "dynamic") {
1600 // Liquid v2 HF, from genesis. Upgrading networks still use "elements".
1601 // TODO fill out genesis block with special commitments including epoch
1602 // length in nTime
1603 throw std::runtime_error(strprintf("Invalid -genesis_style (%s)", consensus.genesis_style));
1604 } else {
1605 throw std::runtime_error(strprintf("Invalid -genesis_style (%s)", consensus.genesis_style));
1606 }
1607 }
1608};
1609
1610

Callers

nothing calls this directly

Calls 6

CreateGenesisBlockFunction · 0.85
CommitToArgumentsFunction · 0.85
AppendInitialIssuanceFunction · 0.85
CScriptClass · 0.70
uint256Class · 0.70
COutPointClass · 0.50

Tested by

no test coverage detected