mirror of
https://github.com/kvazar-network/kevacoin.git
synced 2025-02-04 19:24:20 +00:00
CTransaction, GetValueOut(bool fExcludeKeva)
This commit is contained in:
parent
f94b3294f8
commit
29eb41121d
@ -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
|
||||
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) {
|
||||
nValueOut += tx_out.nValue;
|
||||
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");
|
||||
}
|
||||
|
@ -320,7 +320,7 @@ public:
|
||||
uint256 GetWitnessHash() const;
|
||||
|
||||
// Return sum of txouts.
|
||||
CAmount GetValueOut() const;
|
||||
CAmount GetValueOut(bool fExcludeKeva = false) const;
|
||||
// GetValueIn() is a method on CCoinsViewCache, because
|
||||
// inputs must be known to compute value in.
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user