StakeModifier class.
[NovacoinLibrary.git] / Novacoin / CBlockStore.cs
index 95f65f3..f780a64 100644 (file)
@@ -61,6 +61,11 @@ namespace Novacoin
         public uint nNonce { get; set; }
 
         /// <summary>
+        /// Next block hash.
+        /// </summary>
+        public byte[] nextHash { get; set; }
+
+        /// <summary>
         /// Block type flags
         /// </summary>
         public BlockType BlockTypeFlag { get; set; }
@@ -76,6 +81,11 @@ namespace Novacoin
         public byte nEntropyBit { get; set; }
 
         /// <summary>
+        /// Proof-of-Stake hash
+        /// </summary>
+        public byte[] hashProofOfStake { get; set; }
+
+        /// <summary>
         /// Block height
         /// </summary>
         public uint nHeight { get; set; }
@@ -216,6 +226,14 @@ namespace Novacoin
         }
 
         /// <summary>
+        /// Next block cursor
+        /// </summary>
+        public CBlockStoreItem next
+        {
+            get { return CBlockStore.Instance.GetCursor(nextHash); }
+        }
+
+        /// <summary>
         /// STake modifier generation flag
         /// </summary>
         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); }
+        }
+
         /// <summary>
         /// Sets stake modifier and flag.
         /// </summary>
@@ -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))
             {