This PR adds missing test coverage for the -bytespersigop
option, which determines how pre-taproot signature operations (OP_CHECKSIG{VERIFY}, OP_CHECKMULTIGSIG{VERIFY}) affect fee handling calculations. The setting was introduced in PR #7081 for mitigating the sigop spam attack; the initial implementation rejected txs exceeding the limit, but was changed in #8365 later to account for higher sizes in the mempool (i.e. exceeding the sigop limit is possible, but has to be compensated by higher fees).
For each combination of -bytespersigop
setting and sigops count, the test first creates a P2WSH spending transaction with a witness script that puts sigops in a non-executing branch (OP_FALSE OP_IF OP_CHECKMULTISIG … OP_CHECKSIG … OP_ENDIF). This tx is then bumped up to reach exactly the sig-op limit equivalent vsize by padding its datacarrier output. Based on that, increasing the tx’s vsize should still reflect a vsize increase in the mempool, while a decrease of the tx’s vsize should lead to the mempool treating the tx’s vsize to be the sig-op limit equivalent vsize, since the limit was exceeded.
I assume that this parameter is almost never set explicitly by users (also it is not relevant for taproot spends), but it doesn’t hurt to have a test for it. See also https://bitcoin.stackexchange.com/a/87958 for another explanation.