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