Skip to content

Commit d609fd8

Browse files
committed
Merge #9176: Globals: Pass Consensus::Params through CBlockTreeDB::LoadBlockIndexGuts()
b324b28 Globals: Pass Consensus::Params through CBlockTreeDB::LoadBlockIndexGuts() (Jorge Timón) Tree-SHA512: 9ef561a026960dc69df52603f4d60246c913bdd127465e8238f0954c6bbbc6b8b3b039bab70df38be1cbf5d06788fb631a2236b49c0167633d54366103c7c055
2 parents bef02fb + b324b28 commit d609fd8

File tree

3 files changed

+6
-6
lines changed

3 files changed

+6
-6
lines changed

src/txdb.cpp

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -210,7 +210,7 @@ bool CBlockTreeDB::ReadFlag(const std::string &name, bool &fValue) {
210210
return true;
211211
}
212212

213-
bool CBlockTreeDB::LoadBlockIndexGuts(std::function<CBlockIndex*(const uint256&)> insertBlockIndex)
213+
bool CBlockTreeDB::LoadBlockIndexGuts(const Consensus::Params& consensusParams, std::function<CBlockIndex*(const uint256&)> insertBlockIndex)
214214
{
215215
std::unique_ptr<CDBIterator> pcursor(NewIterator());
216216

@@ -238,12 +238,12 @@ bool CBlockTreeDB::LoadBlockIndexGuts(std::function<CBlockIndex*(const uint256&)
238238
pindexNew->nStatus = diskindex.nStatus;
239239
pindexNew->nTx = diskindex.nTx;
240240

241-
if (!CheckProofOfWork(pindexNew->GetBlockHash(), pindexNew->nBits, Params().GetConsensus()))
242-
return error("LoadBlockIndex(): CheckProofOfWork failed: %s", pindexNew->ToString());
241+
if (!CheckProofOfWork(pindexNew->GetBlockHash(), pindexNew->nBits, consensusParams))
242+
return error("%s: CheckProofOfWork failed: %s", __func__, pindexNew->ToString());
243243

244244
pcursor->Next();
245245
} else {
246-
return error("LoadBlockIndex() : failed to read value");
246+
return error("%s: failed to read value", __func__);
247247
}
248248
} else {
249249
break;

src/txdb.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -122,7 +122,7 @@ class CBlockTreeDB : public CDBWrapper
122122
bool WriteTxIndex(const std::vector<std::pair<uint256, CDiskTxPos> > &list);
123123
bool WriteFlag(const std::string &name, bool fValue);
124124
bool ReadFlag(const std::string &name, bool &fValue);
125-
bool LoadBlockIndexGuts(std::function<CBlockIndex*(const uint256&)> insertBlockIndex);
125+
bool LoadBlockIndexGuts(const Consensus::Params& consensusParams, std::function<CBlockIndex*(const uint256&)> insertBlockIndex);
126126
};
127127

128128
#endif // BITCOIN_TXDB_H

src/validation.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3325,7 +3325,7 @@ CBlockIndex * InsertBlockIndex(uint256 hash)
33253325

33263326
bool static LoadBlockIndexDB(const CChainParams& chainparams)
33273327
{
3328-
if (!pblocktree->LoadBlockIndexGuts(InsertBlockIndex))
3328+
if (!pblocktree->LoadBlockIndexGuts(chainparams.GetConsensus(), InsertBlockIndex))
33293329
return false;
33303330

33313331
boost::this_thread::interruption_point();

0 commit comments

Comments
 (0)