mirror of
https://github.com/bitcoin/bitcoin.git
synced 2025-11-11 22:50:59 +01:00
[MOVEONLY] Move CSCript::FindAndDelete to interpreter
This commit is contained in:
@@ -571,34 +571,6 @@ public:
|
||||
return (opcodetype)(OP_1+n-1);
|
||||
}
|
||||
|
||||
int FindAndDelete(const CScript& b)
|
||||
{
|
||||
int nFound = 0;
|
||||
if (b.empty())
|
||||
return nFound;
|
||||
CScript result;
|
||||
const_iterator pc = begin(), pc2 = begin(), end = this->end();
|
||||
opcodetype opcode;
|
||||
do
|
||||
{
|
||||
result.insert(result.end(), pc2, pc);
|
||||
while (static_cast<size_t>(end - pc) >= b.size() && std::equal(b.begin(), b.end(), pc))
|
||||
{
|
||||
pc = pc + b.size();
|
||||
++nFound;
|
||||
}
|
||||
pc2 = pc;
|
||||
}
|
||||
while (GetOp(pc, opcode));
|
||||
|
||||
if (nFound > 0) {
|
||||
result.insert(result.end(), pc2, end);
|
||||
*this = result;
|
||||
}
|
||||
|
||||
return nFound;
|
||||
}
|
||||
|
||||
/**
|
||||
* Pre-version-0.6, Bitcoin always counted CHECKMULTISIGs
|
||||
* as 20 sigops. With pay-to-script-hash, that changed:
|
||||
|
||||
Reference in New Issue
Block a user