From 6962f1d2f04ff10927dfe101432b66da97c16152 Mon Sep 17 00:00:00 2001 From: Peter Todd Date: Tue, 4 Nov 2014 12:38:56 -0500 Subject: [PATCH] Add IsPushOnly(const_iterator pc) Allows IsPushOnly() to be applied to just part of the script for OP_RETURN outputs. --- src/script/script.cpp | 8 ++++++-- src/script/script.h | 1 + 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/src/script/script.cpp b/src/script/script.cpp index e2b2be3a5..51839a08b 100644 --- a/src/script/script.cpp +++ b/src/script/script.cpp @@ -223,9 +223,8 @@ bool CScript::IsPayToScriptHash() const (*this)[22] == OP_EQUAL); } -bool CScript::IsPushOnly() const +bool CScript::IsPushOnly(const_iterator pc) const { - const_iterator pc = begin(); while (pc < end()) { opcodetype opcode; @@ -241,6 +240,11 @@ bool CScript::IsPushOnly() const return true; } +bool CScript::IsPushOnly() const +{ + return this->IsPushOnly(begin()); +} + // insightexplorer CScript::ScriptType CScript::GetType() const { diff --git a/src/script/script.h b/src/script/script.h index 3b886e581..16787e72e 100644 --- a/src/script/script.h +++ b/src/script/script.h @@ -579,6 +579,7 @@ public: uint160 AddressHash() const; /** Called by IsStandardTx and P2SH/BIP62 VerifyScript (which makes it consensus-critical). */ + bool IsPushOnly(const_iterator pc) const; bool IsPushOnly() const; /**