X-Git-Url: https://git.novaco.in/?p=novacoin.git;a=blobdiff_plain;f=src%2Fscript.cpp;h=6e25fb376a0674f9474fe4653c57c872e7b00a5c;hp=bd58210a0ec38479455c1fa715dde149f5e4aa22;hb=eff0cd3a467d638908b77afc0c50a0a760a351a1;hpb=68c69d7e92c82e374f1976eb0017236976c02e6a diff --git a/src/script.cpp b/src/script.cpp index bd58210..6e25fb3 100644 --- a/src/script.cpp +++ b/src/script.cpp @@ -2246,17 +2246,25 @@ int CScript::FindAndDelete(const CScript& b) int nFound = 0; if (b.empty()) return nFound; - iterator pc = begin(); + CScript result; + iterator pc = begin(), pc2 = begin(); opcodetype opcode; do { - while (end() - pc >= (long)b.size() && memcmp(&pc[0], &b[0], b.size()) == 0) + result.insert(result.end(), pc2, pc); + while (static_cast(end() - pc) >= b.size() && equal(b.begin(), b.end(), pc)) { - erase(pc, pc + b.size()); + pc = pc + b.size(); ++nFound; } + pc2 = pc; } while (GetOp(pc, opcode)); + + if (nFound > 0) { + result.insert(result.end(), pc2, end()); + *this = result; + } return nFound; }