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

Method GetSigOpCount

src/script/script.cpp:156–178  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

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

Callers 5

CreateNewBlockFunction · 0.45
AreInputsStandardFunction · 0.45
BOOST_FOREACHFunction · 0.45
GetP2SHSigOpCountFunction · 0.45
BOOST_AUTO_TEST_CASEFunction · 0.45

Calls 3

GetOpMethod · 0.80
beginMethod · 0.45
endMethod · 0.45

Tested by 1

BOOST_AUTO_TEST_CASEFunction · 0.36