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

Method FindAndDelete

src/script/script.h:558–584  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

556 }
557
558 int FindAndDelete(const CScript& b)
559 {
560 int nFound = 0;
561 if (b.empty())
562 return nFound;
563 CScript result;
564 iterator pc = begin(), pc2 = begin();
565 opcodetype opcode;
566 do
567 {
568 result.insert(result.end(), pc2, pc);
569 while (static_cast<size_t>(end() - pc) >= b.size() && std::equal(b.begin(), b.end(), pc))
570 {
571 pc = pc + b.size();
572 ++nFound;
573 }
574 pc2 = pc;
575 }
576 while (GetOp(pc, opcode));
577
578 if (nFound > 0) {
579 result.insert(result.end(), pc2, end());
580 *this = result;
581 }
582
583 return nFound;
584 }
585 int Find(opcodetype op) const
586 {
587 int nFound = 0;

Callers 3

CleanupScriptCodeFunction · 0.80
SignatureHashOldFunction · 0.80
BOOST_AUTO_TEST_CASEFunction · 0.80

Calls 5

emptyMethod · 0.45
insertMethod · 0.45
endMethod · 0.45
sizeMethod · 0.45
beginMethod · 0.45

Tested by 2

SignatureHashOldFunction · 0.64
BOOST_AUTO_TEST_CASEFunction · 0.64