Use ParamsWrapper for witness serialization

This commit is contained in:
Anthony Towns
2023-09-07 19:16:57 +10:00
parent 5800c558eb
commit 6e9e4e6130
59 changed files with 226 additions and 219 deletions

View File

@@ -16,8 +16,9 @@ bool CheckTransaction(const CTransaction& tx, TxValidationState& state)
if (tx.vout.empty())
return state.Invalid(TxValidationResult::TX_CONSENSUS, "bad-txns-vout-empty");
// Size limits (this doesn't take the witness into account, as that hasn't been checked for malleability)
if (::GetSerializeSize(tx, PROTOCOL_VERSION | SERIALIZE_TRANSACTION_NO_WITNESS) * WITNESS_SCALE_FACTOR > MAX_BLOCK_WEIGHT)
if (::GetSerializeSize(TX_NO_WITNESS(tx)) * WITNESS_SCALE_FACTOR > MAX_BLOCK_WEIGHT) {
return state.Invalid(TxValidationResult::TX_CONSENSUS, "bad-txns-oversize");
}
// Check for negative or overflow output values (see CVE-2010-5139)
CAmount nValueOut = 0;