Get the SigOp count. fAccurate - Accurately count CHECKMULTISIG, see BIP16 for details. Note that this is consensus-critical.
(self, fAccurate)
| 814 | return "CScript([%s])" % ', '.join(ops) |
| 815 | |
| 816 | def GetSigOpCount(self, fAccurate): |
| 817 | """Get the SigOp count. |
| 818 | |
| 819 | fAccurate - Accurately count CHECKMULTISIG, see BIP16 for details. |
| 820 | |
| 821 | Note that this is consensus-critical. |
| 822 | """ |
| 823 | n = 0 |
| 824 | lastOpcode = OP_INVALIDOPCODE |
| 825 | for (opcode, data, sop_idx) in self.raw_iter(): |
| 826 | if opcode in (OP_CHECKSIG, OP_CHECKSIGVERIFY): |
| 827 | n += 1 |
| 828 | elif opcode in (OP_CHECKMULTISIG, OP_CHECKMULTISIGVERIFY): |
| 829 | if fAccurate and (OP_1 <= lastOpcode <= OP_16): |
| 830 | n += opcode.decode_op_n() |
| 831 | else: |
| 832 | n += 20 |
| 833 | lastOpcode = opcode |
| 834 | return n |
| 835 | |
| 836 | |
| 837 | SIGHASH_ALL = 1 |
no test coverage detected