MCPcopy Create free account
hub / github.com/ElementsProject/elements / GetSigOpCount

Method GetSigOpCount

src/script/script.cpp:196–219  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

194}
195
196unsigned int CScript::GetSigOpCount(bool fAccurate) const
197{
198 unsigned int n = 0;
199 const_iterator pc = begin();
200 opcodetype lastOpcode = OP_INVALIDOPCODE;
201 while (pc < end())
202 {
203 opcodetype opcode;
204 if (!GetOp(pc, opcode))
205 break;
206 if (opcode == OP_CHECKSIG || opcode == OP_CHECKSIGVERIFY ||
207 opcode == OP_CHECKSIGFROMSTACK || opcode == OP_CHECKSIGFROMSTACKVERIFY)
208 n++;
209 else if (opcode == OP_CHECKMULTISIG || opcode == OP_CHECKMULTISIGVERIFY)
210 {
211 if (fAccurate && lastOpcode >= OP_1 && lastOpcode <= OP_16)
212 n += DecodeOP_N(lastOpcode);
213 else
214 n += MAX_PUBKEYS_PER_MULTISIG;
215 }
216 lastOpcode = opcode;
217 }
218 return n;
219}
220
221unsigned int CScript::GetSigOpCount(const CScript& scriptSig) const
222{

Callers 7

AreInputsStandardFunction · 0.45
WitnessSigOpsFunction · 0.45
BOOST_AUTO_TEST_CASEFunction · 0.45
FUZZ_TARGETFunction · 0.45
FUZZ_TARGET_INITFunction · 0.45
GetLegacySigOpCountFunction · 0.45
GetP2SHSigOpCountFunction · 0.45

Calls 5

beginFunction · 0.85
endFunction · 0.85
GetOpMethod · 0.80
beginMethod · 0.45
endMethod · 0.45

Tested by 3

BOOST_AUTO_TEST_CASEFunction · 0.36
FUZZ_TARGETFunction · 0.36
FUZZ_TARGET_INITFunction · 0.36