Skip to main content

count_sigops_in_script

Function count_sigops_in_script 

Source
pub fn count_sigops_in_script(script: &Vec<u8>, accurate: bool) -> u32
Expand description

Count sigops in a script (legacy counting)

Counts OP_CHECKSIG, OP_CHECKSIGVERIFY, OP_CHECKMULTISIG, OP_CHECKMULTISIGVERIFY. Matches consensus’s CScript::GetSigOpCount(bool fAccurate).

Uses GetOp-style iteration: each call to the loop body reads one opcode and advances past any associated push data, exactly like consensus’s GetOp().

§Arguments

  • script - Script to count sigops in
  • accurate - If true, use OP_1-OP_16 before OP_CHECKMULTISIG to determine key count

§Returns

Number of sigops in the script