Add checkpoint at block #200000
[NovacoinLibrary.git] / Novacoin / Checkpoints.cs
1 using System;
2
3 namespace Novacoin
4 {
5     public class Checkpoints
6     {
7         private static Tuple<uint, uint256, uint>[] checkpoints = new Tuple<uint, uint256, uint>[]
8             {
9                 new Tuple<uint, uint256, uint>(0, NetInfo.nHashGenesisBlock, 1360105017),
10                 new Tuple<uint, uint256, uint>(200000, new uint256("0000000000029f8bbf66e6ea6f3e5db55009404aae0fe395a53dd33142b2bff2"), 1441127233),
11             };
12
13         /// <summary>
14         /// Last checkpoint height.
15         /// </summary>
16         public static uint TotalBlocksEstimate { get { return checkpoints[checkpoints.Length - 1].Item1; } }
17
18         /// <summary>
19         /// Last checkpoint timestamp.
20         /// </summary>
21         public static uint LastCheckpointTime { get { return checkpoints[checkpoints.Length - 1].Item3; } }
22
23         /// <summary>
24         /// Block hash verification.
25         /// </summary>
26         /// <param name="nHeight">Block height.</param>
27         /// <param name="nBlockHash">Block hash.</param>
28         /// <returns></returns>
29         public static bool Verify(uint nHeight, uint256 nBlockHash)
30         {
31             foreach (var checkpoint in checkpoints)
32             {
33                 if (checkpoint.Item1 == nHeight)
34                 {
35                     return nBlockHash == checkpoint.Item2;
36                 }
37             }
38
39             return true;
40         }
41     }
42 }