Add checkpoints file.
authorCryptoManiac <balthazar.ad@gmail.com>
Mon, 7 Sep 2015 09:40:49 +0000 (12:40 +0300)
committerCryptoManiac <balthazar.ad@gmail.com>
Mon, 7 Sep 2015 09:40:49 +0000 (12:40 +0300)
Novacoin/Checkpoints.cs [new file with mode: 0644]

diff --git a/Novacoin/Checkpoints.cs b/Novacoin/Checkpoints.cs
new file mode 100644 (file)
index 0000000..2d53bba
--- /dev/null
@@ -0,0 +1,41 @@
+using System;
+
+namespace Novacoin
+{
+    public class Checkpoints
+    {
+        private static Tuple<uint, uint256, uint>[] checkpoints = new Tuple<uint, uint256, uint>[]
+            {
+                new Tuple<uint, uint256, uint>(0, NetInfo.nHashGenesisBlock, 1360105017)
+            };
+
+        /// <summary>
+        /// Last checkpoint height.
+        /// </summary>
+        public static uint TotalBlocksEstimate { get { return checkpoints[checkpoints.Length - 1].Item1; } }
+
+        /// <summary>
+        /// Last checkpoint timestamp.
+        /// </summary>
+        public static uint LastCheckpointTime { get { return checkpoints[checkpoints.Length - 1].Item3; } }
+
+        /// <summary>
+        /// Block hash verification.
+        /// </summary>
+        /// <param name="nHeight">Block height.</param>
+        /// <param name="nBlockHash">Block hash.</param>
+        /// <returns></returns>
+        public static bool Verify(uint nHeight, uint256 nBlockHash)
+        {
+            foreach (var checkpoint in checkpoints)
+            {
+                if (checkpoint.Item1 == nHeight)
+                {
+                    return nBlockHash == checkpoint.Item2;
+                }
+            }
+
+            return true;
+        }
+    }
+}
\ No newline at end of file