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

Method SetGenesisBlock

src/chainparams.cpp:963–982  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

961 }
962
963 void SetGenesisBlock() {
964 if (consensus.genesis_style == "bitcoin") {
965 // For compatibility with bitcoin (regtest)
966 genesis = CreateGenesisBlock(1296688602, 2, 0x207fffff, 1, 50 * COIN, consensus);
967 } else if (consensus.genesis_style == "elements") {
968 // Intended compatibility with Liquid v1 and elements-0.14.1
969 std::vector<unsigned char> commit = CommitToArguments(consensus, strNetworkID);
970 genesis = CreateGenesisBlock(consensus, CScript() << commit, CScript(OP_RETURN), 1296688602, 2, 0x207fffff, 1, 0);
971 if (initialFreeCoins != 0 || initial_reissuance_tokens != 0) {
972 AppendInitialIssuance(genesis, COutPoint(uint256(commit), 0), parentGenesisBlockHash, (initialFreeCoins > 0) ? 1 : 0, initialFreeCoins, (initial_reissuance_tokens > 0) ? 1 : 0, initial_reissuance_tokens, CScript() << OP_TRUE);
973 }
974 } else if (consensus.genesis_style == "dynamic") {
975 // Liquid v2 HF, from genesis. Upgrading networks still use "elements".
976 // TODO fill out genesis block with special commitments including epoch
977 // length in nTime
978 throw std::runtime_error(strprintf("Invalid -genesis_style (%s)", consensus.genesis_style));
979 } else {
980 throw std::runtime_error(strprintf("Invalid -genesis_style (%s)", consensus.genesis_style));
981 }
982 }
983
984public:
985 CCustomParams(const std::string& chain, const ArgsManager& args) : CRegTestParams(args)

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