Pass consensus parameters to block index insertion

This commit is contained in:
Capri 2026-09-15 10:57:51 +00:00
commit 49cc3f79a5
Signed by: VextaProject
SSH key fingerprint: SHA256:739BZv8LvIDY2tR7lXLy/IQ6MaGTQtYcG9GNvCjmpVM
2 changed files with 8 additions and 4 deletions

View file

@ -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); 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) if (ppindex)
*ppindex = pindex; *ppindex = pindex;
@ -4385,7 +4387,7 @@ bool CChainState::LoadGenesisBlock()
FlatFilePos blockPos = SaveBlockToDisk(block, 0, m_chain, m_params, nullptr); FlatFilePos blockPos = SaveBlockToDisk(block, 0, m_chain, m_params, nullptr);
if (blockPos.IsNull()) if (blockPos.IsNull())
return error("%s: writing genesis block to disk failed", __func__); 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); ReceivedBlockTransactions(block, pindex, blockPos);
} catch (const std::runtime_error& e) { } catch (const std::runtime_error& e) {
return error("%s: failed to write genesis block: %s", __func__, e.what()); return error("%s: failed to write genesis block: %s", __func__, e.what());

View file

@ -474,7 +474,9 @@ public:
/** Clear all data members. */ /** Clear all data members. */
void Unload() EXCLUSIVE_LOCKS_REQUIRED(cs_main); 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 */ /** Create a new block index entry for a given block hash */
CBlockIndex* InsertBlockIndex(const uint256& hash) EXCLUSIVE_LOCKS_REQUIRED(cs_main); CBlockIndex* InsertBlockIndex(const uint256& hash) EXCLUSIVE_LOCKS_REQUIRED(cs_main);