aboutsummaryrefslogtreecommitdiff
path: root/src/core.cpp
diff options
context:
space:
mode:
authorGavin Andresen <gavinandresen@gmail.com>2013-11-11 16:03:51 +1000
committerGavin Andresen <gavinandresen@gmail.com>2013-11-30 15:42:10 +1000
commit0733c1bde69c6ccfe593d2eec775d0ae32fe7140 (patch)
tree05a186706a752322ad057188c5660687162b2246 /src/core.cpp
parent98c7c8fd1d3712e02be0e9f2eeca7e02aa54d197 (diff)
Refactor: move GetValueIn(tx) to tx.GetValueIn()
GetValueIn makes more sense as a CTransaction member.
Diffstat (limited to 'src/core.cpp')
-rw-r--r--src/core.cpp12
1 files changed, 12 insertions, 0 deletions
diff --git a/src/core.cpp b/src/core.cpp
index 7a1c90e587..5da6f11b51 100644
--- a/src/core.cpp
+++ b/src/core.cpp
@@ -106,6 +106,18 @@ bool CTransaction::IsNewerThan(const CTransaction& old) const
return fNewer;
}
+int64_t CTransaction::GetValueOut() const
+{
+ int64_t nValueOut = 0;
+ BOOST_FOREACH(const CTxOut& txout, vout)
+ {
+ nValueOut += txout.nValue;
+ if (!MoneyRange(txout.nValue) || !MoneyRange(nValueOut))
+ throw std::runtime_error("CTransaction::GetValueOut() : value out of range");
+ }
+ return nValueOut;
+}
+
std::string CTransaction::ToString() const
{
std::string str;