Browse Source

Merge #9176: Globals: Pass Consensus::Params through CBlockTreeDB::LoadBlockIndexGuts()

b324b28 Globals: Pass Consensus::Params through CBlockTreeDB::LoadBlockIndexGuts() (Jorge Timón)

Tree-SHA512: 9ef561a026960dc69df52603f4d60246c913bdd127465e8238f0954c6bbbc6b8b3b039bab70df38be1cbf5d06788fb631a2236b49c0167633d54366103c7c055
0.15
Wladimir J. van der Laan 8 years ago
parent
commit
d609fd85ca
No known key found for this signature in database
GPG Key ID: 1E4AED62986CD25D
  1. 8
      src/txdb.cpp
  2. 2
      src/txdb.h
  3. 2
      src/validation.cpp

8
src/txdb.cpp

@ -210,7 +210,7 @@ bool CBlockTreeDB::ReadFlag(const std::string &name, bool &fValue) {
return true; return true;
} }
bool CBlockTreeDB::LoadBlockIndexGuts(std::function<CBlockIndex*(const uint256&)> insertBlockIndex) bool CBlockTreeDB::LoadBlockIndexGuts(const Consensus::Params& consensusParams, std::function<CBlockIndex*(const uint256&)> insertBlockIndex)
{ {
std::unique_ptr<CDBIterator> pcursor(NewIterator()); std::unique_ptr<CDBIterator> pcursor(NewIterator());
@ -238,12 +238,12 @@ bool CBlockTreeDB::LoadBlockIndexGuts(std::function<CBlockIndex*(const uint256&)
pindexNew->nStatus = diskindex.nStatus; pindexNew->nStatus = diskindex.nStatus;
pindexNew->nTx = diskindex.nTx; pindexNew->nTx = diskindex.nTx;
if (!CheckProofOfWork(pindexNew->GetBlockHash(), pindexNew->nBits, Params().GetConsensus())) if (!CheckProofOfWork(pindexNew->GetBlockHash(), pindexNew->nBits, consensusParams))
return error("LoadBlockIndex(): CheckProofOfWork failed: %s", pindexNew->ToString()); return error("%s: CheckProofOfWork failed: %s", __func__, pindexNew->ToString());
pcursor->Next(); pcursor->Next();
} else { } else {
return error("LoadBlockIndex() : failed to read value"); return error("%s: failed to read value", __func__);
} }
} else { } else {
break; break;

2
src/txdb.h

@ -122,7 +122,7 @@ public:
bool WriteTxIndex(const std::vector<std::pair<uint256, CDiskTxPos> > &list); bool WriteTxIndex(const std::vector<std::pair<uint256, CDiskTxPos> > &list);
bool WriteFlag(const std::string &name, bool fValue); bool WriteFlag(const std::string &name, bool fValue);
bool ReadFlag(const std::string &name, bool &fValue); bool ReadFlag(const std::string &name, bool &fValue);
bool LoadBlockIndexGuts(std::function<CBlockIndex*(const uint256&)> insertBlockIndex); bool LoadBlockIndexGuts(const Consensus::Params& consensusParams, std::function<CBlockIndex*(const uint256&)> insertBlockIndex);
}; };
#endif // BITCOIN_TXDB_H #endif // BITCOIN_TXDB_H

2
src/validation.cpp

@ -3325,7 +3325,7 @@ CBlockIndex * InsertBlockIndex(uint256 hash)
bool static LoadBlockIndexDB(const CChainParams& chainparams) bool static LoadBlockIndexDB(const CChainParams& chainparams)
{ {
if (!pblocktree->LoadBlockIndexGuts(InsertBlockIndex)) if (!pblocktree->LoadBlockIndexGuts(chainparams.GetConsensus(), InsertBlockIndex))
return false; return false;
boost::this_thread::interruption_point(); boost::this_thread::interruption_point();

Loading…
Cancel
Save