MCPcopy Create free account
hub / github.com/Bitcoin-ABC/bitcoin-abc / FindAndDelete

Function FindAndDelete

src/script/interpreter.cpp:45–71  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

43}
44
45int FindAndDelete(CScript &script, const CScript &b) {
46 int nFound = 0;
47 if (b.empty()) {
48 return nFound;
49 }
50
51 CScript result;
52 CScript::const_iterator pc = script.begin(), pc2 = script.begin(),
53 end = script.end();
54 opcodetype opcode;
55 do {
56 result.insert(result.end(), pc2, pc);
57 while (static_cast<size_t>(end - pc) >= b.size() &&
58 std::equal(b.begin(), b.end(), pc)) {
59 pc = pc + b.size();
60 ++nFound;
61 }
62 pc2 = pc;
63 } while (script.GetOp(pc, opcode));
64
65 if (nFound > 0) {
66 result.insert(result.end(), pc2, end);
67 script = std::move(result);
68 }
69
70 return nFound;
71}
72
73static void CleanupScriptCode(CScript &scriptCode,
74 const std::vector<uint8_t> &vchSig,

Callers 4

CleanupScriptCodeFunction · 0.70
SignatureHashOldFunction · 0.50
BOOST_AUTO_TEST_CASEFunction · 0.50
FUZZ_TARGET_INITFunction · 0.50

Calls 6

GetOpMethod · 0.80
emptyMethod · 0.45
beginMethod · 0.45
endMethod · 0.45
insertMethod · 0.45
sizeMethod · 0.45

Tested by 3

SignatureHashOldFunction · 0.40
BOOST_AUTO_TEST_CASEFunction · 0.40
FUZZ_TARGET_INITFunction · 0.40