ValueOut property.
[NovacoinLibrary.git] / Novacoin / CTransaction.cs
index 1070703..8402b12 100644 (file)
@@ -20,6 +20,7 @@ using System;
 using System.Text;
 using System.Collections.Generic;
 using System.IO;
+using System.Diagnostics.Contracts;
 
 namespace Novacoin
 {
@@ -398,9 +399,26 @@ namespace Novacoin
         /// <summary>
         /// Transaction hash
         /// </summary>
-        public Hash256 Hash
+        public uint256 Hash
         {
-            get { return Hash256.Compute256(this); }
+            get { return CryptoUtils.ComputeHash256(this); }
+        }
+
+        /// <summary>
+        /// Amount of novacoins spent by this transaction.
+        /// </summary>
+        public ulong ValueOut
+        {
+            get
+            {
+                ulong nValueOut = 0;
+                foreach (var txout in vout)
+                {
+                    nValueOut += txout.nValue;
+                    Contract.Assert(MoneyRange(txout.nValue) && MoneyRange(nValueOut));
+                }
+                return nValueOut;
+            }
         }
 
         /// <summary>