Changeset View
Changeset View
Standalone View
Standalone View
src/policy/policy.cpp
Show First 20 Lines • Show All 49 Lines • ▼ Show 20 Lines | if (tx.nVersion > CTransaction::MAX_STANDARD_VERSION || tx.nVersion < 1) { | ||||
reason = "version"; | reason = "version"; | ||||
return false; | return false; | ||||
} | } | ||||
// Extremely large transactions with lots of inputs can cost the network | // Extremely large transactions with lots of inputs can cost the network | ||||
// almost as much to process as they cost the sender in fees, because | // almost as much to process as they cost the sender in fees, because | ||||
// computing signature hashes is O(ninputs*txsize). Limiting transactions | // computing signature hashes is O(ninputs*txsize). Limiting transactions | ||||
// to MAX_STANDARD_TX_SIZE mitigates CPU exhaustion attacks. | // to MAX_STANDARD_TX_SIZE mitigates CPU exhaustion attacks. | ||||
unsigned int sz = GetTransactionSize(tx); | unsigned int sz = tx.GetTotalSize(); | ||||
if (sz >= MAX_STANDARD_TX_SIZE) { | if (sz >= MAX_STANDARD_TX_SIZE) { | ||||
reason = "tx-size"; | reason = "tx-size"; | ||||
return false; | return false; | ||||
} | } | ||||
for (const CTxIn &txin : tx.vin) { | for (const CTxIn &txin : tx.vin) { | ||||
// Biggest 'standard' txin is a 15-of-15 P2SH multisig with compressed | // Biggest 'standard' txin is a 15-of-15 P2SH multisig with compressed | ||||
// keys (remember the 520 byte limit on redeemScript size). That works | // keys (remember the 520 byte limit on redeemScript size). That works | ||||
▲ Show 20 Lines • Show All 79 Lines • Show Last 20 Lines |