From 2914b32b20e9c1b9867cafac15d4118e014fc623 Mon Sep 17 00:00:00 2001 From: CryptoManiac Date: Mon, 7 Sep 2015 12:40:49 +0300 Subject: [PATCH] Add checkpoints file. --- Novacoin/Checkpoints.cs | 41 +++++++++++++++++++++++++++++++++++++++++ 1 files changed, 41 insertions(+), 0 deletions(-) create mode 100644 Novacoin/Checkpoints.cs diff --git a/Novacoin/Checkpoints.cs b/Novacoin/Checkpoints.cs new file mode 100644 index 0000000..2d53bba --- /dev/null +++ b/Novacoin/Checkpoints.cs @@ -0,0 +1,41 @@ +using System; + +namespace Novacoin +{ + public class Checkpoints + { + private static Tuple[] checkpoints = new Tuple[] + { + new Tuple(0, NetInfo.nHashGenesisBlock, 1360105017) + }; + + /// + /// Last checkpoint height. + /// + public static uint TotalBlocksEstimate { get { return checkpoints[checkpoints.Length - 1].Item1; } } + + /// + /// Last checkpoint timestamp. + /// + public static uint LastCheckpointTime { get { return checkpoints[checkpoints.Length - 1].Item3; } } + + /// + /// Block hash verification. + /// + /// Block height. + /// Block hash. + /// + 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 -- 1.7.1