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

Method GetSigOpCount

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

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

Callers 1

get_legacy_sigopcount_txFunction · 0.45

Calls 2

raw_iterMethod · 0.95
decode_op_nMethod · 0.80

Tested by

no test coverage detected