ValueOut property.
authorCryptoManiac <balthazar@yandex.ru>
Sat, 5 Sep 2015 13:42:24 +0000 (16:42 +0300)
committerCryptoManiac <balthazar@yandex.ru>
Sat, 5 Sep 2015 13:42:24 +0000 (16:42 +0300)
Novacoin/CTransaction.cs

index fb865a4..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
 {
@@ -404,6 +405,23 @@ namespace Novacoin
         }
 
         /// <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>
         /// A sequence of bytes, which corresponds to the current state of CTransaction.
         /// </summary>
         public static implicit operator byte[] (CTransaction tx)