Skip to content

Commit b324b28

Browse files
committed
Globals: Pass Consensus::Params through CBlockTreeDB::LoadBlockIndexGuts()
1 parent ea6fde3 commit b324b28

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
@@ -169,7 +169,7 @@ bool CBlockTreeDB::ReadFlag(const std::string &name, bool &fValue) {
169169
return true;
170170
}
171171

172-
bool CBlockTreeDB::LoadBlockIndexGuts(std::function<CBlockIndex*(const uint256&)> insertBlockIndex)
172+
bool CBlockTreeDB::LoadBlockIndexGuts(const Consensus::Params& consensusParams, std::function<CBlockIndex*(const uint256&)> insertBlockIndex)
173173
{
174174
std::unique_ptr<CDBIterator> pcursor(NewIterator());
175175

@@ -197,12 +197,12 @@ bool CBlockTreeDB::LoadBlockIndexGuts(std::function<CBlockIndex*(const uint256&)
197197
pindexNew->nStatus = diskindex.nStatus;
198198
pindexNew->nTx = diskindex.nTx;
199199

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

203203
pcursor->Next();
204204
} else {
205-
return error("LoadBlockIndex() : failed to read value");
205+
return error("%s: failed to read value", __func__);
206206
}
207207
} else {
208208
break;

src/txdb.h

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

126126
#endif // BITCOIN_TXDB_H

src/validation.cpp

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

32473247
bool static LoadBlockIndexDB(const CChainParams& chainparams)
32483248
{
3249-
if (!pblocktree->LoadBlockIndexGuts(InsertBlockIndex))
3249+
if (!pblocktree->LoadBlockIndexGuts(chainparams.GetConsensus(), InsertBlockIndex))
32503250
return false;
32513251

32523252
boost::this_thread::interruption_point();

0 commit comments

Comments
 (0)