Sigops limits have been changed to budget in Tapscript. BIP341 defines the budget calculation method as follows.
The budget equals 50 + the total serialized size in bytes of the transaction input's witness (including the CompactSize prefix). Executing a signature opcode (OP_CHECKSIG, OP_CHECKSIGVERIFY, or OP_CHECKSIGADD) with a non-empty signature decrements the budget by 50.
https://github.com/bitcoin/bips/blob/master/bip-0342.mediawiki#Resource_limits
This CompactSize prefix include the number of witness elements at the beginning?
For example, if I have the following 5 sizes of witness data,
compact size | witness size |
---|---|
1 | 65 |
1 | 64 |
1 | 91 |
3 | 257 |
3 | 563 |
The total size including the above Compact Size is 1049
. In addition to this, do I need to add the number of bytes(1
) of CompactSize for the number of elements(5
)?
That's because the above data output by Bitcoin Core feature_taproot.py is 1050
. The final budget will be 1100
, which is 50
added to this.