| 154 | } |
| 155 | |
| 156 | unsigned 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 | |
| 180 | unsigned int CScript::GetSigOpCount(const CScript& scriptSig) const |
| 181 | { |