diff options
author | Pieter Wuille <sipa@ulyssis.org> | 2013-09-24 00:45:18 +0200 |
---|---|---|
committer | Pieter Wuille <sipa@ulyssis.org> | 2014-02-11 20:38:23 +0100 |
commit | 9aea601b05b3541fcc7e0c45cba8fd2178224809 (patch) | |
tree | 539e6ff08c7000b71cdbaaf93a5e68521bce463c | |
parent | d5fa3eff03b4e58fc46d72599904231408cbce80 (diff) |
Move IsPushOnly() to script.cpp
-rw-r--r-- | src/script.cpp | 18 | ||||
-rw-r--r-- | src/script.h | 18 |
2 files changed, 19 insertions, 17 deletions
diff --git a/src/script.cpp b/src/script.cpp index 2b66bc73d6..b2d8a67f96 100644 --- a/src/script.cpp +++ b/src/script.cpp @@ -1863,6 +1863,24 @@ bool CScript::IsPayToScriptHash() const this->at(22) == OP_EQUAL); } +bool CScript::IsPushOnly() const +{ + const_iterator pc = begin(); + while (pc < end()) + { + opcodetype opcode; + if (!GetOp(pc, opcode)) + return false; + // Note that IsPushOnly() *does* consider OP_RESERVED to be a + // push-type opcode, however execution of OP_RESERVED fails, so + // it's not relevant to P2SH as the scriptSig would fail prior to + // the P2SH special validation code being executed. + if (opcode > OP_16) + return false; + } + return true; +} + class CScriptVisitor : public boost::static_visitor<bool> { private: diff --git a/src/script.h b/src/script.h index bd120cc07d..a0a6cd1c44 100644 --- a/src/script.h +++ b/src/script.h @@ -542,23 +542,7 @@ public: bool IsPayToScriptHash() const; // Called by IsStandardTx - bool IsPushOnly() const - { - const_iterator pc = begin(); - while (pc < end()) - { - opcodetype opcode; - if (!GetOp(pc, opcode)) - return false; - // Note that IsPushOnly() *does* consider OP_RESERVED to be a - // push-type opcode, however execution of OP_RESERVED fails, so - // it's not relevant to P2SH as the scriptSig would fail prior to - // the P2SH special validation code being executed. - if (opcode > OP_16) - return false; - } - return true; - } + bool IsPushOnly() const; // Returns whether the script is guaranteed to fail at execution, // regardless of the initial stack. This allows outputs to be pruned |