From b9cd39da5b7744f29c938ec53a99f7595e71c9ad Mon Sep 17 00:00:00 2001 From: CryptoManiac Date: Sat, 5 Sep 2015 16:42:24 +0300 Subject: [PATCH] ValueOut property. --- Novacoin/CTransaction.cs | 18 ++++++++++++++++++ 1 files changed, 18 insertions(+), 0 deletions(-) diff --git a/Novacoin/CTransaction.cs b/Novacoin/CTransaction.cs index fb865a4..8402b12 100644 --- a/Novacoin/CTransaction.cs +++ b/Novacoin/CTransaction.cs @@ -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 } /// + /// Amount of novacoins spent by this transaction. + /// + public ulong ValueOut + { + get + { + ulong nValueOut = 0; + foreach (var txout in vout) + { + nValueOut += txout.nValue; + Contract.Assert(MoneyRange(txout.nValue) && MoneyRange(nValueOut)); + } + return nValueOut; + } + } + + /// /// A sequence of bytes, which corresponds to the current state of CTransaction. /// public static implicit operator byte[] (CTransaction tx) -- 1.7.1