MCPcopy Create free account
hub / github.com/bitcoin/bitcoin / FindAndDelete

Function FindAndDelete

src/script/interpreter.cpp:239–265  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

237}
238
239int FindAndDelete(CScript& script, const CScript& b)
240{
241 int nFound = 0;
242 if (b.empty())
243 return nFound;
244 CScript result;
245 CScript::const_iterator pc = script.begin(), pc2 = script.begin(), end = script.end();
246 opcodetype opcode;
247 do
248 {
249 result.insert(result.end(), pc2, pc);
250 while (static_cast<size_t>(end - pc) >= b.size() && std::equal(b.begin(), b.end(), pc))
251 {
252 pc = pc + b.size();
253 ++nFound;
254 }
255 pc2 = pc;
256 }
257 while (script.GetOp(pc, opcode));
258
259 if (nFound > 0) {
260 result.insert(result.end(), pc2, end);
261 script = std::move(result);
262 }
263
264 return nFound;
265}
266
267namespace {
268/** A data type to abstract out the condition stack during script execution.

Callers 5

EvalChecksigPreTapscriptFunction · 0.70
EvalScriptFunction · 0.70
SignatureHashOldFunction · 0.50
BOOST_AUTO_TEST_CASEFunction · 0.50
script.cppFile · 0.50

Calls 6

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

Tested by 2

SignatureHashOldFunction · 0.40
BOOST_AUTO_TEST_CASEFunction · 0.40