Dogecoin Core  1.14.2
P2P Digital Currency
checkpoints.cpp
Go to the documentation of this file.
1 // Copyright (c) 2009-2016 The Bitcoin Core developers
2 // Distributed under the MIT software license, see the accompanying
3 // file COPYING or http://www.opensource.org/licenses/mit-license.php.
4 
5 #include "checkpoints.h"
6 
7 #include "chain.h"
8 #include "chainparams.h"
9 #include "validation.h"
10 #include "uint256.h"
11 
12 #include <stdint.h>
13 
14 #include <boost/foreach.hpp>
15 
16 namespace Checkpoints {
17 
19  {
20  const MapCheckpoints& checkpoints = data.mapCheckpoints;
21 
22  BOOST_REVERSE_FOREACH(const MapCheckpoints::value_type& i, checkpoints)
23  {
24  const uint256& hash = i.second;
25  BlockMap::const_iterator t = mapBlockIndex.find(hash);
26  if (t != mapBlockIndex.end())
27  return t->second;
28  }
29  return NULL;
30  }
31 
32 } // namespace Checkpoints
std::map< int, uint256 > MapCheckpoints
Definition: chainparams.h:27
The block chain is a tree shaped structure starting with the genesis block at the root,...
Definition: chain.h:158
256-bit opaque blob.
Definition: uint256.h:123
Block-chain checkpoints are compiled-in sanity checks.
Definition: checkpoints.cpp:16
CBlockIndex * GetLastCheckpoint(const CCheckpointData &data)
Returns last CBlockIndex* in mapBlockIndex that is a checkpoint.
Definition: checkpoints.cpp:18
MapCheckpoints mapCheckpoints
Definition: chainparams.h:30
BlockMap mapBlockIndex
Definition: validation.cpp:63