X-Git-Url: https://git.novaco.in/?p=NovacoinLibrary.git;a=blobdiff_plain;f=Novacoin%2FCBlockStore.cs;h=f780a6470617e465278765e65b25e32ae1d4df81;hp=95f65f308f68bda380f7d7d9266a3eca161599c7;hb=12f67828e449407a93bdb3202066003a48a8c276;hpb=3fdb213eb50e007c0ec0d6b377c4777624c06163 diff --git a/Novacoin/CBlockStore.cs b/Novacoin/CBlockStore.cs index 95f65f3..f780a64 100644 --- a/Novacoin/CBlockStore.cs +++ b/Novacoin/CBlockStore.cs @@ -61,6 +61,11 @@ namespace Novacoin public uint nNonce { get; set; } /// + /// Next block hash. + /// + public byte[] nextHash { get; set; } + + /// /// Block type flags /// public BlockType BlockTypeFlag { get; set; } @@ -76,6 +81,11 @@ namespace Novacoin public byte nEntropyBit { get; set; } /// + /// Proof-of-Stake hash + /// + public byte[] hashProofOfStake { get; set; } + + /// /// Block height /// public uint nHeight { get; set; } @@ -216,6 +226,14 @@ namespace Novacoin } /// + /// Next block cursor + /// + public CBlockStoreItem next + { + get { return CBlockStore.Instance.GetCursor(nextHash); } + } + + /// /// STake modifier generation flag /// public bool GeneratedStakeModifier @@ -223,6 +241,11 @@ namespace Novacoin get { return (BlockTypeFlag & BlockType.BLOCK_STAKE_MODIFIER) != 0; } } + public uint StakeEntropyBit + { + get { return ((uint)(BlockTypeFlag & BlockType.BLOCK_STAKE_ENTROPY) >> 1); } + } + /// /// Sets stake modifier and flag. /// @@ -513,7 +536,10 @@ namespace Novacoin // TODO: compute stake modifier // Add to index - itemTemplate.BlockTypeFlag = block.IsProofOfStake ? BlockType.PROOF_OF_STAKE : BlockType.PROOF_OF_WORK; + if (block.IsProofOfStake) + { + itemTemplate.SetProofOfStake(); + } if (!itemTemplate.WriteToFile(ref writer, ref block)) {