PPCoin: Change checkpoint intervals to smaller intervals
[novacoin.git] / src / checkpoints.h
1 // Copyright (c) 2011 The Bitcoin developers
2 // Copyright (c) 2011-2012 The PPCoin developers
3 // Distributed under the MIT/X11 software license, see the accompanying
4 // file license.txt or http://www.opensource.org/licenses/mit-license.php.
5 #ifndef BITCOIN_CHECKPOINT_H
6 #define  BITCOIN_CHECKPOINT_H
7
8 #include <map>
9 #include "util.h"
10
11 // ppcoin: auto checkpoint min at 8 hours; max at 16 hours
12 #define AUTO_CHECKPOINT_MIN_SPAN   (60 * 60 * 8)
13 #define AUTO_CHECKPOINT_MAX_SPAN   (60 * 60 * 16)
14 #define AUTO_CHECKPOINT_TRUST_SPAN (60 * 60 * 24)
15
16 class uint256;
17 class CBlockIndex;
18
19 //
20 // Block-chain checkpoints are compiled-in sanity checks.
21 // They are updated every release or three.
22 //
23 namespace Checkpoints
24 {
25     extern int nAutoCheckpoint;
26     extern int nBranchPoint;
27
28     // Returns true if block passes checkpoint checks
29     bool CheckHardened(int nHeight, const uint256& hash);
30     bool CheckAuto(const CBlockIndex *pindex);
31
32     int  GetNextChainCheckpoint(const CBlockIndex *pindex);
33     int  GetNextAutoCheckpoint(int nCheckpoint);
34     void AdvanceAutoCheckpoint(int nCheckpoint);
35     bool ResetAutoCheckpoint(int nCheckpoint);
36
37     // Return conservative estimate of total number of blocks, 0 if unknown
38     int GetTotalBlocksEstimate();
39
40     // Returns last CBlockIndex* in mapBlockIndex that is a checkpoint
41     CBlockIndex* GetLastCheckpoint(const std::map<uint256, CBlockIndex*>& mapBlockIndex);
42 }
43
44 #endif