Get the SigOp count. fAccurate - Accurately count CHECKMULTISIG, see BIP16 for details. Note that this is consensus-critical.
(self, fAccurate)
| 664 | return "CScript([%s])" % ', '.join(ops) |
| 665 | |
| 666 | def GetSigOpCount(self, fAccurate): |
| 667 | """Get the SigOp count. |
| 668 | |
| 669 | fAccurate - Accurately count CHECKMULTISIG, see BIP16 for details. |
| 670 | |
| 671 | Note that this is consensus-critical. |
| 672 | """ |
| 673 | n = 0 |
| 674 | lastOpcode = OP_INVALIDOPCODE |
| 675 | for (opcode, data, sop_idx) in self.raw_iter(): |
| 676 | if opcode in (OP_CHECKSIG, OP_CHECKSIGVERIFY): |
| 677 | n += 1 |
| 678 | elif opcode in (OP_CHECKMULTISIG, OP_CHECKMULTISIGVERIFY): |
| 679 | if fAccurate and (OP_1 <= lastOpcode <= OP_16): |
| 680 | n += opcode.decode_op_n() |
| 681 | else: |
| 682 | n += 20 |
| 683 | lastOpcode = opcode |
| 684 | return n |
| 685 | |
| 686 | |
| 687 | SIGHASH_DEFAULT = 0 # Taproot-only default, semantics same as SIGHASH_ALL |