Get the SigOp count. fAccurate - Accurately count CHECKMULTISIG, see BIP16 for details. Note that this is consensus-critical.
(self, fAccurate)
| 545 | return "CScript([%s])" % ', '.join(ops) |
| 546 | |
| 547 | def GetSigOpCount(self, fAccurate): |
| 548 | """Get the SigOp count. |
| 549 | |
| 550 | fAccurate - Accurately count CHECKMULTISIG, see BIP16 for details. |
| 551 | |
| 552 | Note that this is consensus-critical. |
| 553 | """ |
| 554 | n = 0 |
| 555 | lastOpcode = OP_INVALIDOPCODE |
| 556 | for (opcode, data, sop_idx) in self.raw_iter(): |
| 557 | if opcode in (OP_CHECKSIG, OP_CHECKSIGVERIFY): |
| 558 | n += 1 |
| 559 | elif opcode in (OP_CHECKMULTISIG, OP_CHECKMULTISIGVERIFY): |
| 560 | if fAccurate and (OP_1 <= lastOpcode <= OP_16): |
| 561 | n += opcode.decode_op_n() |
| 562 | else: |
| 563 | n += 20 |
| 564 | lastOpcode = opcode |
| 565 | return n |
| 566 | |
| 567 | |
| 568 | SIGHASH_ALL = 1 |
no test coverage detected