Changeset View
Changeset View
Standalone View
Standalone View
src/checkpoints.cpp
Show All 17 Lines | bool CheckBlock(const CCheckpointData &data, int nHeight, | ||||
MapCheckpoints::const_iterator i = checkpoints.find(nHeight); | MapCheckpoints::const_iterator i = checkpoints.find(nHeight); | ||||
if (i == checkpoints.end()) { | if (i == checkpoints.end()) { | ||||
return true; | return true; | ||||
} | } | ||||
return hash == i->second; | return hash == i->second; | ||||
} | } | ||||
CBlockIndex *GetLastCheckpoint(const CCheckpointData &data) { | CBlockIndex *GetLastCheckpoint(const CCheckpointData &data) | ||||
EXCLUSIVE_LOCKS_REQUIRED(cs_main) { | |||||
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 BlockHash &hash = i.second; | const BlockHash &hash = i.second; | ||||
CBlockIndex *pindex = LookupBlockIndex(hash); | CBlockIndex *pindex = LookupBlockIndex(hash); | ||||
if (pindex) { | if (pindex) { | ||||
return pindex; | return pindex; | ||||
} | } | ||||
} | } | ||||
return nullptr; | return nullptr; | ||||
} | } | ||||
} // namespace Checkpoints | } // namespace Checkpoints |