diff --git a/src/node/blockstorage.cpp b/src/node/blockstorage.cpp index 471d33fd73..75dca7e838 100755 --- a/src/node/blockstorage.cpp +++ b/src/node/blockstorage.cpp @@ -334,9 +334,9 @@ bool BlockManager::WriteBlockIndexDB() return true; } -bool BlockManager::LoadBlockIndexDB() +bool BlockManager::LoadBlockIndexDB(const Consensus::Params& consensus_params) { - if (!LoadBlockIndex(::Params().GetConsensus())) { + if (!LoadBlockIndex(consensus_params)) { return false; } diff --git a/src/node/blockstorage.h b/src/node/blockstorage.h index c5f568afdf..632ae9331e 100644 --- a/src/node/blockstorage.h +++ b/src/node/blockstorage.h @@ -160,7 +160,7 @@ public: std::unique_ptr m_block_tree_db GUARDED_BY(::cs_main); bool WriteBlockIndexDB() EXCLUSIVE_LOCKS_REQUIRED(::cs_main); - bool LoadBlockIndexDB() EXCLUSIVE_LOCKS_REQUIRED(::cs_main); + bool LoadBlockIndexDB(const Consensus::Params& consensus_params) EXCLUSIVE_LOCKS_REQUIRED(::cs_main); CBlockIndex* AddToBlockIndex(const CBlockHeader& block, CBlockIndex*& best_header) EXCLUSIVE_LOCKS_REQUIRED(cs_main); /** Create a new block index entry for a given block hash */ diff --git a/src/validation.cpp b/src/validation.cpp index 4710976a26..8ec36d04f4 100755 --- a/src/validation.cpp +++ b/src/validation.cpp @@ -4597,7 +4597,7 @@ bool ChainstateManager::LoadBlockIndex() // Load block index from databases bool needs_init = fReindex; if (!fReindex) { - bool ret = m_blockman.LoadBlockIndexDB(); + bool ret = m_blockman.LoadBlockIndexDB(GetConsensus()); if (!ret) return false; std::vector vSortedByHeight{m_blockman.GetAllBlockIndices()};