Changeset View
Changeset View
Standalone View
Standalone View
src/consensus/tx_check.cpp
Show All 23 Lines | static bool CheckTransactionCommon(const CTransaction &tx, | ||||
} | } | ||||
// Size limit | // Size limit | ||||
if (::GetSerializeSize(tx, PROTOCOL_VERSION) > MAX_TX_SIZE) { | if (::GetSerializeSize(tx, PROTOCOL_VERSION) > MAX_TX_SIZE) { | ||||
return state.Invalid(TxValidationResult::TX_CONSENSUS, REJECT_INVALID, | return state.Invalid(TxValidationResult::TX_CONSENSUS, REJECT_INVALID, | ||||
"bad-txns-oversize"); | "bad-txns-oversize"); | ||||
} | } | ||||
// Check for negative or overflow output values | // Check for negative or overflow output values (see CVE-2010-5139) | ||||
Amount nValueOut = Amount::zero(); | Amount nValueOut = Amount::zero(); | ||||
for (const auto &txout : tx.vout) { | for (const auto &txout : tx.vout) { | ||||
if (txout.nValue < Amount::zero()) { | if (txout.nValue < Amount::zero()) { | ||||
return state.Invalid(TxValidationResult::TX_CONSENSUS, | return state.Invalid(TxValidationResult::TX_CONSENSUS, | ||||
REJECT_INVALID, "bad-txns-vout-negative"); | REJECT_INVALID, "bad-txns-vout-negative"); | ||||
} | } | ||||
if (txout.nValue > MAX_MONEY) { | if (txout.nValue > MAX_MONEY) { | ||||
▲ Show 20 Lines • Show All 67 Lines • Show Last 20 Lines |