Add stake modifier checkpoints & do some cleanup
[NovacoinLibrary.git] / Novacoin / DatabaseObjects.cs
index a78f93b..cb93d2d 100644 (file)
@@ -502,11 +502,6 @@ namespace Novacoin
         }
 
         /// <summary>
-        /// Stake modifier checksum.
-        /// </summary>
-        public uint nStakeModifierChecksum;
-
-        /// <summary>
         /// Chain trust score
         /// </summary>
         [Ignore]
@@ -612,7 +607,7 @@ namespace Novacoin
             {
                 reader.Seek(nBlockPos + nTxOffset, SeekOrigin.Begin); // Seek to transaction offset
 
-                if (nTxSize != reader.Read(buffer, 0, nTxSize))
+                if (nTxSize != reader.Read(buffer, 0, (int)nTxSize))
                 {
                     return false;
                 }
@@ -647,9 +642,9 @@ namespace Novacoin
         /// Transaction size accessor
         /// </summary>
         [Ignore]
-        public int nTxSize
+        public uint nTxSize
         {
-            get { return (int)VarInt.DecodeVarInt(TxSize); }
+            get { return (uint)VarInt.DecodeVarInt(TxSize); }
             private set { TxSize = VarInt.EncodeVarInt(value); }
         }
 
@@ -665,6 +660,10 @@ namespace Novacoin
             get { return TransactionFlags == TxFlags.TX_COINSTAKE; }
         }
 
+        public CMerkleNode()
+        {
+        }
+
         public CMerkleNode(CTransaction tx)
         {
             nTime = tx.nTime;
@@ -719,6 +718,12 @@ namespace Novacoin
     public class TxOutItem
     {
         /// <summary>
+        /// Outpoint identifier.
+        /// </summary>
+        [PrimaryKey, AutoIncrement]
+        public long nOutpointID { get; set; }
+
+        /// <summary>
         /// Reference to transaction item.
         /// </summary>
         [ForeignKey(typeof(CMerkleNode), Name = "nMerkleNodeID")]
@@ -758,7 +763,7 @@ namespace Novacoin
         /// Getter for output value.
         /// </summary>
         [Ignore]
-        public ulong nValue
+        public long nValue
         {
             get { return VarInt.DecodeVarInt(OutputValue); }
             set { OutputValue = VarInt.EncodeVarInt(value); }
@@ -782,6 +787,23 @@ namespace Novacoin
     public class InputsJoin : TxOutItem
     {
         public byte[] TransactionHash { get; set; }
+
+        /// <summary>
+        /// To avoid awkwardness of sqlite wrapper.
+        /// </summary>
+        /// <returns></returns>
+        public TxOutItem getTxOutItem()
+        {
+            return new TxOutItem()
+            {
+                nOutpointID = nOutpointID,
+                nMerkleNodeID = nMerkleNodeID,
+                outputFlags = outputFlags,
+                OutputNumber = OutputNumber,
+                OutputValue = OutputValue,
+                scriptPubKey = scriptPubKey
+            };
+        }
     }