Dash Core Source Documentation (0.16.0.1)

Find detailed information regarding the Dash Core source code.

checkpoints.cpp
Go to the documentation of this file.
1 // Copyright (c) 2009-2014 The Bitcoin developers
2 // Copyright (c) 2014-2020 The Dash Core developers
3 // Distributed under the MIT software license, see the accompanying
4 // file COPYING or http://www.opensource.org/licenses/mit-license.php.
5 
6 #include <checkpoints.h>
7 
8 #include <chain.h>
9 #include <chainparams.h>
10 #include <reverse_iterator.h>
11 #include <validation.h>
12 
13 #include <stdint.h>
14 
15 
16 namespace Checkpoints {
17 
19  {
20  const MapCheckpoints& checkpoints = data.mapCheckpoints;
21 
22  for (const MapCheckpoints::value_type& i : reverse_iterate(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 nullptr;
30  }
31 
32 } // namespace Checkpoints
std::map< int, uint256 > MapCheckpoints
Definition: chainparams.h:22
reverse_range< T > reverse_iterate(T &x)
BlockMap & mapBlockIndex
Definition: validation.cpp:215
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
256-bit opaque blob.
Definition: uint256.h:123
MapCheckpoints mapCheckpoints
Definition: chainparams.h:25
The block chain is a tree shaped structure starting with the genesis block at the root...
Definition: chain.h:170
Released under the MIT license