diff --git a/src/txdb.cpp b/src/txdb.cpp index c8f50902932..97e916fd220 100644 --- a/src/txdb.cpp +++ b/src/txdb.cpp @@ -210,7 +210,7 @@ bool CBlockTreeDB::ReadFlag(const std::string &name, bool &fValue) { return true; } -bool CBlockTreeDB::LoadBlockIndexGuts(std::function insertBlockIndex) +bool CBlockTreeDB::LoadBlockIndexGuts(const Consensus::Params& consensusParams, std::function insertBlockIndex) { std::unique_ptr pcursor(NewIterator()); @@ -238,12 +238,12 @@ bool CBlockTreeDB::LoadBlockIndexGuts(std::functionnStatus = diskindex.nStatus; pindexNew->nTx = diskindex.nTx; - if (!CheckProofOfWork(pindexNew->GetBlockHash(), pindexNew->nBits, Params().GetConsensus())) - return error("LoadBlockIndex(): CheckProofOfWork failed: %s", pindexNew->ToString()); + if (!CheckProofOfWork(pindexNew->GetBlockHash(), pindexNew->nBits, consensusParams)) + return error("%s: CheckProofOfWork failed: %s", __func__, pindexNew->ToString()); pcursor->Next(); } else { - return error("LoadBlockIndex() : failed to read value"); + return error("%s: failed to read value", __func__); } } else { break; diff --git a/src/txdb.h b/src/txdb.h index 974dd4ebe35..2a3e4eb6961 100644 --- a/src/txdb.h +++ b/src/txdb.h @@ -122,7 +122,7 @@ public: bool WriteTxIndex(const std::vector > &list); bool WriteFlag(const std::string &name, bool fValue); bool ReadFlag(const std::string &name, bool &fValue); - bool LoadBlockIndexGuts(std::function insertBlockIndex); + bool LoadBlockIndexGuts(const Consensus::Params& consensusParams, std::function insertBlockIndex); }; #endif // BITCOIN_TXDB_H diff --git a/src/validation.cpp b/src/validation.cpp index 59542e8f983..f09fff8ee8d 100644 --- a/src/validation.cpp +++ b/src/validation.cpp @@ -3325,7 +3325,7 @@ CBlockIndex * InsertBlockIndex(uint256 hash) bool static LoadBlockIndexDB(const CChainParams& chainparams) { - if (!pblocktree->LoadBlockIndexGuts(InsertBlockIndex)) + if (!pblocktree->LoadBlockIndexGuts(chainparams.GetConsensus(), InsertBlockIndex)) return false; boost::this_thread::interruption_point();