Changeset View
Changeset View
Standalone View
Standalone View
src/primitives/transaction.cpp
Show First 20 Lines • Show All 67 Lines • ▼ Show 20 Lines | 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 = Amount::zero(); | Amount nValueOut = Amount::zero(); | ||||
for (std::vector<CTxOut>::const_iterator it(vout.begin()); it != vout.end(); | for (const auto &tx_out : vout) { | ||||
++it) { | nValueOut += tx_out.nValue; | ||||
nValueOut += it->nValue; | if (!MoneyRange(tx_out.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; | ||||
} | } | ||||
double CTransaction::ComputePriority(double dPriorityInputs, | double CTransaction::ComputePriority(double dPriorityInputs, | ||||
▲ Show 20 Lines • Show All 51 Lines • Show Last 20 Lines |