Changeset View
Changeset View
Standalone View
Standalone View
src/primitives/transaction.cpp
Show First 20 Lines • Show All 79 Lines • ▼ Show 20 Lines | |||||
CTransaction::CTransaction(const CMutableTransaction &tx) | CTransaction::CTransaction(const CMutableTransaction &tx) | ||||
: nVersion(tx.nVersion), vin(tx.vin), vout(tx.vout), | : nVersion(tx.nVersion), vin(tx.vin), vout(tx.vout), | ||||
nLockTime(tx.nLockTime), hash(ComputeHash()) {} | nLockTime(tx.nLockTime), hash(ComputeHash()) {} | ||||
CTransaction::CTransaction(CMutableTransaction &&tx) | CTransaction::CTransaction(CMutableTransaction &&tx) | ||||
: nVersion(tx.nVersion), vin(std::move(tx.vin)), vout(std::move(tx.vout)), | : nVersion(tx.nVersion), vin(std::move(tx.vin)), vout(std::move(tx.vout)), | ||||
nLockTime(tx.nLockTime), hash(ComputeHash()) {} | nLockTime(tx.nLockTime), hash(ComputeHash()) {} | ||||
Amount CTransaction::GetValueOut() const { | Amount CTransaction::GetValueOut() const { | ||||
Amount nValueOut = 0; | Amount nValueOut(0); | ||||
for (std::vector<CTxOut>::const_iterator it(vout.begin()); it != vout.end(); | for (std::vector<CTxOut>::const_iterator it(vout.begin()); it != vout.end(); | ||||
++it) { | ++it) { | ||||
nValueOut += it->nValue; | nValueOut += it->nValue; | ||||
if (!MoneyRange(it->nValue) || !MoneyRange(nValueOut)) | if (!MoneyRange(it->nValue) || !MoneyRange(nValueOut)) | ||||
throw std::runtime_error(std::string(__func__) + | throw std::runtime_error(std::string(__func__) + | ||||
": value out of range"); | ": value out of range"); | ||||
} | } | ||||
return nValueOut; | return nValueOut; | ||||
▲ Show 20 Lines • Show All 47 Lines • Show Last 20 Lines |