MCPcopy Create free account
hub / github.com/bitcoinxt/bitcoinxt / GetSigOpCount

Method GetSigOpCount

qa/rpc-tests/test_framework/script.py:804–822  ·  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

802 return "CScript([%s])" % ', '.join(ops)
803
804 def GetSigOpCount(self, fAccurate):
805 """Get the SigOp count.
806
807 fAccurate - Accurately count CHECKMULTISIG, see BIP16 for details.
808
809 Note that this is consensus-critical.
810 """
811 n = 0
812 lastOpcode = OP_INVALIDOPCODE
813 for (opcode, data, sop_idx) in self.raw_iter():
814 if opcode in (OP_CHECKSIG, OP_CHECKSIGVERIFY):
815 n += 1
816 elif opcode in (OP_CHECKMULTISIG, OP_CHECKMULTISIGVERIFY):
817 if fAccurate and (OP_1 <= lastOpcode <= OP_16):
818 n += opcode.decode_op_n()
819 else:
820 n += 20
821 lastOpcode = opcode
822 return n
823
824
825SIGHASH_ALL = 1

Callers

nothing calls this directly

Calls 2

raw_iterMethod · 0.95
decode_op_nMethod · 0.80

Tested by

no test coverage detected