Changeset View
Changeset View
Standalone View
Standalone View
src/policy/policy.cpp
Show First 20 Lines • Show All 59 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 = tx.GetTotalSize(); | uint32_t 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 65 Lines • ▼ Show 20 Lines | for (const CTxIn &in : tx.vin) { | ||||
BaseSignatureChecker())) { | BaseSignatureChecker())) { | ||||
return false; | return false; | ||||
} | } | ||||
if (stack.empty()) { | if (stack.empty()) { | ||||
return false; | return false; | ||||
} | } | ||||
CScript subscript(stack.back().begin(), stack.back().end()); | CScript subscript(stack.back().begin(), stack.back().end()); | ||||
if (subscript.GetSigOpCount(true) > MAX_P2SH_SIGOPS) { | if (subscript.GetSigOpCount(STANDARD_CHECKDATASIG_VERIFY_FLAGS, | ||||
true) > MAX_P2SH_SIGOPS) { | |||||
return false; | return false; | ||||
} | } | ||||
} | } | ||||
} | } | ||||
return true; | return true; | ||||
} | } | ||||
CFeeRate dustRelayFee = CFeeRate(DUST_RELAY_TX_FEE); | CFeeRate dustRelayFee = CFeeRate(DUST_RELAY_TX_FEE); | ||||
uint32_t nBytesPerSigOp = DEFAULT_BYTES_PER_SIGOP; | uint32_t nBytesPerSigOp = DEFAULT_BYTES_PER_SIGOP; |