Merge bitcoin/bitcoin#32129: doc: Update comments for AreInputsStandard to match code

52ede28a8a doc: Update comments for AreInputsStandard to match code (Anthony Towns)

Pull request description:

  The comment about extra data stuffed in scriptSigs was introduced in #4365 which introduced `ScriptSigArgsExpected()`, and became incorrect after #7387 / #7453 (checks are now performed by `SCRIPT_VERIFY_CLEANSTACK` during script validation and `IsPushOnly()` in `IsStandardTx()`). Drops the details on what a p2sh with many checksigs would look like, which was already done in #4365, but only for main.cpp not the duplicated comment in main.h, which was merged into policy/policy.cpp in #6335 and later moved to the right place in #10682.

ACKs for top commit:
  instagibbs:
    ACK 52ede28a8a
  darosior:
    ACK 52ede28a8a

Tree-SHA512: 5ee9a775c81d4c23aca2f8f938ab8bfa7605af489ddb78788613195be8744c7fb7a37bae271093f67f572577452651d4958706b55346e99cf8d32ac0fc34df03
This commit is contained in:
merge-script 2025-03-27 15:46:04 +08:00
commit 8cc601196b
No known key found for this signature in database
GPG key ID: 2EEB9F5CC09526C1

View file

@ -169,20 +169,18 @@ bool IsStandardTx(const CTransaction& tx, const std::optional<unsigned>& max_dat
} }
/** /**
* Check transaction inputs to mitigate two * Check transaction inputs.
* potential denial-of-service attacks:
* *
* 1. scriptSigs with extra data stuffed into them, * This does three things:
* not consumed by scriptPubKey (or P2SH script) * * Prevents mempool acceptance of spends of future
* 2. P2SH scripts with a crazy number of expensive * segwit versions we don't know how to validate
* CHECKSIG/CHECKMULTISIG operations * * Mitigates a potential denial-of-service attack with
* * P2SH scripts with a crazy number of expensive
* Why bother? To avoid denial-of-service attacks; an attacker * CHECKSIG/CHECKMULTISIG operations.
* can submit a standard HASH... OP_EQUAL transaction, * * Prevents spends of unknown/irregular scriptPubKeys,
* which will get accepted into blocks. The redemption * which mitigates potential denial-of-service attacks
* script can be anything; an attacker could use a very * involving expensive scripts and helps reserve them
* expensive-to-check-upon-redemption script like: * as potential new upgrade hooks.
* DUP CHECKSIG DROP ... repeated 100 times... OP_1
* *
* Note that only the non-witness portion of the transaction is checked here. * Note that only the non-witness portion of the transaction is checked here.
*/ */