This is an alternative to #8755 and #8654
This implements a static estimation of sighash size for a transaction. A transaction with more than 90bytes of sighash per weight is non-standard. This is equivalent to 36MB for an 100kB non-segwit transaction, or 360MB for a block in the worst case. All existing standard transactions with legitimate use of CHECK(MULTI)SIG
should remain standard with this limit.
The estimation of sighash is based on the assumption that SignatureHash
is performed once only for each signature within a CHECKMULTISIG
. This PR does not depend on any other policy or softforks like those in #8755. Despite the counting is more conservative, legitimate standard transactions for #8755 should also be standard in this implementation.
Todo: unit tests