Changeset View
Changeset View
Standalone View
Standalone View
src/checkpoints.cpp
Show All 21 Lines | bool CheckBlock(const CCheckpointData &data, int nHeight, const uint256 &hash) { | ||||
return hash == i->second; | return hash == i->second; | ||||
} | } | ||||
CBlockIndex *GetLastCheckpoint(const CCheckpointData &data) { | CBlockIndex *GetLastCheckpoint(const CCheckpointData &data) { | ||||
const MapCheckpoints &checkpoints = data.mapCheckpoints; | const MapCheckpoints &checkpoints = data.mapCheckpoints; | ||||
for (const MapCheckpoints::value_type &i : reverse_iterate(checkpoints)) { | for (const MapCheckpoints::value_type &i : reverse_iterate(checkpoints)) { | ||||
const uint256 &hash = i.second; | const uint256 &hash = i.second; | ||||
BlockMap::const_iterator t = mapBlockIndex.find(hash); | CBlockIndex *pindex = LookupBlockIndex(hash); | ||||
if (t != mapBlockIndex.end()) { | if (pindex) { | ||||
return t->second; | return pindex; | ||||
} | } | ||||
} | } | ||||
return nullptr; | return nullptr; | ||||
} | } | ||||
} // namespace Checkpoints | } // namespace Checkpoints |