|
|
|
@ -6,6 +6,7 @@
@@ -6,6 +6,7 @@
|
|
|
|
|
#include <primitives/transaction.h> |
|
|
|
|
|
|
|
|
|
#include <hash.h> |
|
|
|
|
#include <script/keva.h> |
|
|
|
|
#include <tinyformat.h> |
|
|
|
|
#include <utilstrencodings.h> |
|
|
|
|
|
|
|
|
@ -86,11 +87,13 @@ CTransaction::CTransaction() : vin(), vout(), nVersion(CTransaction::CURRENT_VER
@@ -86,11 +87,13 @@ CTransaction::CTransaction() : vin(), vout(), nVersion(CTransaction::CURRENT_VER
|
|
|
|
|
CTransaction::CTransaction(const CMutableTransaction &tx) : vin(tx.vin), vout(tx.vout), nVersion(tx.nVersion), nLockTime(tx.nLockTime), hash(ComputeHash()) {} |
|
|
|
|
CTransaction::CTransaction(CMutableTransaction &&tx) : vin(std::move(tx.vin)), vout(std::move(tx.vout)), nVersion(tx.nVersion), nLockTime(tx.nLockTime), hash(ComputeHash()) {} |
|
|
|
|
|
|
|
|
|
CAmount CTransaction::GetValueOut() const |
|
|
|
|
CAmount CTransaction::GetValueOut(bool fExcludeKeva) const |
|
|
|
|
{ |
|
|
|
|
CAmount nValueOut = 0; |
|
|
|
|
for (const auto& tx_out : vout) { |
|
|
|
|
if (!fExcludeKeva || !CKevaScript::isKevaScript(tx_out.scriptPubKey)) { |
|
|
|
|
nValueOut += tx_out.nValue; |
|
|
|
|
} |
|
|
|
|
if (!MoneyRange(tx_out.nValue) || !MoneyRange(nValueOut)) |
|
|
|
|
throw std::runtime_error(std::string(__func__) + ": value out of range"); |
|
|
|
|
} |
|
|
|
|