From e8a0ef53b99bca651b090fcb0acaa9dc96baa153 Mon Sep 17 00:00:00 2001 From: RealEther Date: Fri, 12 Jul 2024 00:20:12 +0530 Subject: [PATCH] Update Currency.cpp --- src/CryptoNoteCore/Currency.cpp | 16 ++++++---------- 1 file changed, 6 insertions(+), 10 deletions(-) diff --git a/src/CryptoNoteCore/Currency.cpp b/src/CryptoNoteCore/Currency.cpp index 3a4758d3b1..7769bca23b 100755 --- a/src/CryptoNoteCore/Currency.cpp +++ b/src/CryptoNoteCore/Currency.cpp @@ -124,19 +124,14 @@ bool Currency::constructGenesisTransaction(Transaction& tx) const { bool Currency::generateGenesisBlock() { m_genesisBlock = boost::value_initialized(); - // Hardcoded genesis coinbase transaction - std::string genesisCoinbaseTxHex = GENESIS_COINBASE_TX_HEX; - BinaryArray minerTxBlob; - - bool r = - fromHex(genesisCoinbaseTxHex, minerTxBlob) && - fromBinaryArray(m_genesisBlock.baseTransaction, minerTxBlob); - - if (!r) { - logger(ERROR, BRIGHT_RED) << "Failed to parse coinbase tx from hardcoded blob"; + Transaction genesisTransaction; + if (!constructGenesisTransaction(genesisTransaction)) { + logger(ERROR, BRIGHT_RED) << "Failed to construct genesis transaction"; return false; } + m_genesisBlock.baseTransaction = genesisTransaction; + m_genesisBlock.majorVersion = BLOCK_MAJOR_VERSION_1; m_genesisBlock.minorVersion = BLOCK_MINOR_VERSION_0; m_genesisBlock.timestamp = 0; @@ -154,6 +149,7 @@ bool Currency::generateGenesisBlock() { logger(INFO) << "Genesis block generated with hash: " << Common::podToHex(m_genesisBlockHash); return true; } +} bool Currency::getBlockReward(size_t medianSize, size_t currentBlockSize, uint64_t alreadyGeneratedCoins, uint64_t fee, uint64_t& reward, int64_t& emissionChange) const {