From: CryptoManiac Date: Sat, 5 Sep 2015 13:42:24 +0000 (+0300) Subject: ValueOut property. X-Git-Url: https://git.novaco.in/?p=NovacoinLibrary.git;a=commitdiff_plain;h=b9cd39da5b7744f29c938ec53a99f7595e71c9ad ValueOut property. --- 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)