| 279 | } |
| 280 | |
| 281 | int FindAndDelete(CScript& script, const CScript& b) |
| 282 | { |
| 283 | int nFound = 0; |
| 284 | if (b.empty()) |
| 285 | return nFound; |
| 286 | CScript result; |
| 287 | CScript::const_iterator pc = script.begin(), pc2 = script.begin(), end = script.end(); |
| 288 | opcodetype opcode; |
| 289 | do |
| 290 | { |
| 291 | result.insert(result.end(), pc2, pc); |
| 292 | while (static_cast<size_t>(end - pc) >= b.size() && std::equal(b.begin(), b.end(), pc)) |
| 293 | { |
| 294 | pc = pc + b.size(); |
| 295 | ++nFound; |
| 296 | } |
| 297 | pc2 = pc; |
| 298 | } |
| 299 | while (script.GetOp(pc, opcode)); |
| 300 | |
| 301 | if (nFound > 0) { |
| 302 | result.insert(result.end(), pc2, end); |
| 303 | script = std::move(result); |
| 304 | } |
| 305 | |
| 306 | return nFound; |
| 307 | } |
| 308 | |
| 309 | bool EvalScript(std::vector<std::vector<unsigned char> >& stack, const CScript& script, unsigned int flags, const BaseSignatureChecker& checker, SigVersion sigversion, ScriptError* serror) |
| 310 | { |