Changeset View
Changeset View
Standalone View
Standalone View
src/consensus/tx_verify.cpp
Show First 20 Lines • Show All 44 Lines • ▼ Show 20 Lines | if (!IsFinalTx(tx, nHeight, nLockTimeCutoff)) { | ||||
// While this is only one transaction, we use txns in the error to | // While this is only one transaction, we use txns in the error to | ||||
// ensure continuity with other clients. | // ensure continuity with other clients. | ||||
return state.DoS(10, false, REJECT_INVALID, "bad-txns-nonfinal", false, | return state.DoS(10, false, REJECT_INVALID, "bad-txns-nonfinal", false, | ||||
"non-final transaction"); | "non-final transaction"); | ||||
} | } | ||||
if (IsMagneticAnomalyEnabled(params, nHeight)) { | if (IsMagneticAnomalyEnabled(params, nHeight)) { | ||||
// Size limit | // Size limit | ||||
if (::GetSerializeSize(tx, SER_NETWORK, PROTOCOL_VERSION) < | if (::GetSerializeSize(tx, PROTOCOL_VERSION) < MIN_TX_SIZE) { | ||||
MIN_TX_SIZE) { | |||||
return state.DoS(100, false, REJECT_INVALID, "bad-txns-undersize"); | return state.DoS(100, false, REJECT_INVALID, "bad-txns-undersize"); | ||||
} | } | ||||
} | } | ||||
return true; | return true; | ||||
} | } | ||||
/** | /** | ||||
▲ Show 20 Lines • Show All 131 Lines • ▼ Show 20 Lines | if (tx.vin.empty()) { | ||||
return state.DoS(10, false, REJECT_INVALID, "bad-txns-vin-empty"); | return state.DoS(10, false, REJECT_INVALID, "bad-txns-vin-empty"); | ||||
} | } | ||||
if (tx.vout.empty()) { | if (tx.vout.empty()) { | ||||
return state.DoS(10, false, REJECT_INVALID, "bad-txns-vout-empty"); | return state.DoS(10, false, REJECT_INVALID, "bad-txns-vout-empty"); | ||||
} | } | ||||
// Size limit | // Size limit | ||||
if (::GetSerializeSize(tx, SER_NETWORK, PROTOCOL_VERSION) > MAX_TX_SIZE) { | if (::GetSerializeSize(tx, PROTOCOL_VERSION) > MAX_TX_SIZE) { | ||||
return state.DoS(100, false, REJECT_INVALID, "bad-txns-oversize"); | return state.DoS(100, false, REJECT_INVALID, "bad-txns-oversize"); | ||||
} | } | ||||
// Check for negative or overflow output values | // Check for negative or overflow output values | ||||
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.DoS(100, false, REJECT_INVALID, | return state.DoS(100, false, REJECT_INVALID, | ||||
▲ Show 20 Lines • Show All 122 Lines • Show Last 20 Lines |