| 194 | } |
| 195 | |
| 196 | unsigned 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 | |
| 221 | unsigned int CScript::GetSigOpCount(const CScript& scriptSig) const |
| 222 | { |