Skip to content

Commit a4741bd

Browse files
committed
kernel: pass params to BlockManager rather than using a global
1 parent 1c7ef0a commit a4741bd

File tree

3 files changed

+4
-4
lines changed

3 files changed

+4
-4
lines changed

src/node/blockstorage.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -318,9 +318,9 @@ bool BlockManager::WriteBlockIndexDB()
318318
return true;
319319
}
320320

321-
bool BlockManager::LoadBlockIndexDB()
321+
bool BlockManager::LoadBlockIndexDB(const Consensus::Params& consensus_params)
322322
{
323-
if (!LoadBlockIndex(::Params().GetConsensus())) {
323+
if (!LoadBlockIndex(consensus_params)) {
324324
return false;
325325
}
326326

src/node/blockstorage.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -153,7 +153,7 @@ class BlockManager
153153
std::unique_ptr<CBlockTreeDB> m_block_tree_db GUARDED_BY(::cs_main);
154154

155155
bool WriteBlockIndexDB() EXCLUSIVE_LOCKS_REQUIRED(::cs_main);
156-
bool LoadBlockIndexDB() EXCLUSIVE_LOCKS_REQUIRED(::cs_main);
156+
bool LoadBlockIndexDB(const Consensus::Params& consensus_params) EXCLUSIVE_LOCKS_REQUIRED(::cs_main);
157157

158158
CBlockIndex* AddToBlockIndex(const CBlockHeader& block, CBlockIndex*& best_header) EXCLUSIVE_LOCKS_REQUIRED(cs_main);
159159
/** Create a new block index entry for a given block hash */

src/validation.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4158,7 +4158,7 @@ bool ChainstateManager::LoadBlockIndex()
41584158
// Load block index from databases
41594159
bool needs_init = fReindex;
41604160
if (!fReindex) {
4161-
bool ret = m_blockman.LoadBlockIndexDB();
4161+
bool ret = m_blockman.LoadBlockIndexDB(GetConsensus());
41624162
if (!ret) return false;
41634163

41644164
std::vector<CBlockIndex*> vSortedByHeight{m_blockman.GetAllBlockIndices()};

0 commit comments

Comments
 (0)