1 // Copyright (c) 2009-2018 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 #ifndef BITCOIN_CHECKPOINTS_H
6 #define BITCOIN_CHECKPOINTS_H
7 
8 #include <uint256.h>
9 
10 #include <map>
11 
12 class CBlockIndex;
13 struct CCheckpointData;
14 
15 /**
16  * Block-chain checkpoints are compiled-in sanity checks.
17  * They are updated every release or three.
18  */
19 namespace Checkpoints
20 {
21 
22 //! Checks that the block hash at height nHeight matches the expected hardened checkpoint
23 bool CheckHardened(int nHeight, const uint256& hash, const CCheckpointData& data);
24 
25 //! Returns last CBlockIndex* that is a checkpoint
26 CBlockIndex* GetLastCheckpoint(const CCheckpointData& data);
27 
28 //! Returns last CBlockIndex* from the auto selected checkpoint
29 const CBlockIndex* AutoSelectSyncCheckpoint();
30 
31 //! Check against automatically selected checkpoint
32 bool CheckSync(int nHeight);
33 } //namespace Checkpoints
34 
35 #endif // BITCOIN_CHECKPOINTS_H
36