diff --git a/src/validation.cpp b/src/validation.cpp index ddfa035..3a72242 100644 --- a/src/validation.cpp +++ b/src/validation.cpp @@ -3027,7 +3027,9 @@ void CChainState::ResetBlockFailureFlags(CBlockIndex *pindex) { } } -CBlockIndex* BlockManager::AddToBlockIndex(const CBlockHeader& block) +CBlockIndex* BlockManager::AddToBlockIndex( + const CBlockHeader& block, + const Consensus::Params& consensus_params) { AssertLockHeld(cs_main); @@ -3573,7 +3575,7 @@ bool BlockManager::AcceptBlockHeader(const CBlockHeader& block, BlockValidationS } } } - CBlockIndex* pindex = AddToBlockIndex(block); + CBlockIndex* pindex = AddToBlockIndex(block, chainparams.GetConsensus()); if (ppindex) *ppindex = pindex; @@ -4385,7 +4387,7 @@ bool CChainState::LoadGenesisBlock() FlatFilePos blockPos = SaveBlockToDisk(block, 0, m_chain, m_params, nullptr); if (blockPos.IsNull()) return error("%s: writing genesis block to disk failed", __func__); - CBlockIndex *pindex = m_blockman.AddToBlockIndex(block); + CBlockIndex *pindex = m_blockman.AddToBlockIndex(block, m_params.GetConsensus()); ReceivedBlockTransactions(block, pindex, blockPos); } catch (const std::runtime_error& e) { return error("%s: failed to write genesis block: %s", __func__, e.what()); diff --git a/src/validation.h b/src/validation.h index 0e04b88..646dc06 100644 --- a/src/validation.h +++ b/src/validation.h @@ -474,7 +474,9 @@ public: /** Clear all data members. */ void Unload() EXCLUSIVE_LOCKS_REQUIRED(cs_main); - CBlockIndex* AddToBlockIndex(const CBlockHeader& block) EXCLUSIVE_LOCKS_REQUIRED(cs_main); + CBlockIndex* AddToBlockIndex( + const CBlockHeader& block, + const Consensus::Params& consensus_params) EXCLUSIVE_LOCKS_REQUIRED(cs_main); /** Create a new block index entry for a given block hash */ CBlockIndex* InsertBlockIndex(const uint256& hash) EXCLUSIVE_LOCKS_REQUIRED(cs_main);