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

Method GetSigOpCount

src/script/script.cpp:159–181  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

157}
158
159unsigned int CScript::GetSigOpCount(bool fAccurate) const
160{
161 unsigned int n = 0;
162 const_iterator pc = begin();
163 opcodetype lastOpcode = OP_INVALIDOPCODE;
164 while (pc < end())
165 {
166 opcodetype opcode;
167 if (!GetOp(pc, opcode))
168 break;
169 if (opcode == OP_CHECKSIG || opcode == OP_CHECKSIGVERIFY)
170 n++;
171 else if (opcode == OP_CHECKMULTISIG || opcode == OP_CHECKMULTISIGVERIFY)
172 {
173 if (fAccurate && lastOpcode >= OP_1 && lastOpcode <= OP_16)
174 n += DecodeOP_N(lastOpcode);
175 else
176 n += MAX_PUBKEYS_PER_MULTISIG;
177 }
178 lastOpcode = opcode;
179 }
180 return n;
181}
182
183unsigned int CScript::GetSigOpCount(const CScript& scriptSig) const
184{

Callers 8

CheckSigopsBIP54Function · 0.45
WitnessSigOpsFunction · 0.45
BOOST_AUTO_TEST_CASEFunction · 0.45
BOOST_FIXTURE_TEST_CASEFunction · 0.45
FUZZ_TARGETFunction · 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
BOOST_FIXTURE_TEST_CASEFunction · 0.36
FUZZ_TARGETFunction · 0.36