From: CryptoManiac Date: Mon, 7 Sep 2015 09:40:49 +0000 (+0300) Subject: Add checkpoints file. X-Git-Url: https://git.novaco.in/?p=NovacoinLibrary.git;a=commitdiff_plain;h=2914b32b20e9c1b9867cafac15d4118e014fc623;hp=624ac1021490395614a0cbee619c79860c22061a Add checkpoints file. --- 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