MCPcopy Create free account
hub / github.com/LUX-Core/lux / GetSigOpCount

Method GetSigOpCount

test/functional/test_framework/script.py:816–834  ·  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

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
837SIGHASH_ALL = 1

Callers 1

get_legacy_sigopcount_txFunction · 0.45

Calls 2

raw_iterMethod · 0.95
decode_op_nMethod · 0.45

Tested by

no test coverage detected