Skip to content

Commit 9aea601

Browse files
committed
Move IsPushOnly() to script.cpp
1 parent d5fa3ef commit 9aea601

File tree

2 files changed

+19
-17
lines changed

2 files changed

+19
-17
lines changed

src/script.cpp

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1863,6 +1863,24 @@ bool CScript::IsPayToScriptHash() const
18631863
this->at(22) == OP_EQUAL);
18641864
}
18651865

1866+
bool CScript::IsPushOnly() const
1867+
{
1868+
const_iterator pc = begin();
1869+
while (pc < end())
1870+
{
1871+
opcodetype opcode;
1872+
if (!GetOp(pc, opcode))
1873+
return false;
1874+
// Note that IsPushOnly() *does* consider OP_RESERVED to be a
1875+
// push-type opcode, however execution of OP_RESERVED fails, so
1876+
// it's not relevant to P2SH as the scriptSig would fail prior to
1877+
// the P2SH special validation code being executed.
1878+
if (opcode > OP_16)
1879+
return false;
1880+
}
1881+
return true;
1882+
}
1883+
18661884
class CScriptVisitor : public boost::static_visitor<bool>
18671885
{
18681886
private:

src/script.h

Lines changed: 1 addition & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -542,23 +542,7 @@ class CScript : public std::vector<unsigned char>
542542
bool IsPayToScriptHash() const;
543543

544544
// Called by IsStandardTx
545-
bool IsPushOnly() const
546-
{
547-
const_iterator pc = begin();
548-
while (pc < end())
549-
{
550-
opcodetype opcode;
551-
if (!GetOp(pc, opcode))
552-
return false;
553-
// Note that IsPushOnly() *does* consider OP_RESERVED to be a
554-
// push-type opcode, however execution of OP_RESERVED fails, so
555-
// it's not relevant to P2SH as the scriptSig would fail prior to
556-
// the P2SH special validation code being executed.
557-
if (opcode > OP_16)
558-
return false;
559-
}
560-
return true;
561-
}
545+
bool IsPushOnly() const;
562546

563547
// Returns whether the script is guaranteed to fail at execution,
564548
// regardless of the initial stack. This allows outputs to be pruned

0 commit comments

Comments
 (0)