MCPcopy Index your code
hub / github.com/petertodd/python-bitcoinlib / GetSigOpCount

Method GetSigOpCount

bitcoin/core/script.py:793–811  ·  view source on GitHub ↗

Get the SigOp count. fAccurate - Accurately count CHECKMULTISIG, see BIP16 for details. Note that this is consensus-critical.

(self, fAccurate)

Source from the content-addressed store, hash-verified

791 return CScript([OP_HASH160, bitcoin.core.Hash160(self), OP_EQUAL])
792
793 def GetSigOpCount(self, fAccurate):
794 """Get the SigOp count.
795
796 fAccurate - Accurately count CHECKMULTISIG, see BIP16 for details.
797
798 Note that this is consensus-critical.
799 """
800 n = 0
801 lastOpcode = OP_INVALIDOPCODE
802 for (opcode, data, sop_idx) in self.raw_iter():
803 if opcode in (OP_CHECKSIG, OP_CHECKSIGVERIFY):
804 n += 1
805 elif opcode in (OP_CHECKMULTISIG, OP_CHECKMULTISIGVERIFY):
806 if fAccurate and (OP_1 <= lastOpcode <= OP_16):
807 n += opcode.decode_op_n()
808 else:
809 n += 20
810 lastOpcode = opcode
811 return n
812
813class CScriptWitness(ImmutableSerializable):
814 """An encoding of the data elements on the initial stack for (segregated

Callers 1

GetLegacySigOpCountFunction · 0.80

Calls 2

raw_iterMethod · 0.95
decode_op_nMethod · 0.80

Tested by

no test coverage detected