From db034013fa0c48c71629f7e92353c01a7c2fc0f2 Mon Sep 17 00:00:00 2001 From: CryptoManiac Date: Sun, 21 Feb 2016 21:06:08 +0300 Subject: [PATCH] Simplify OP_RETURN handling. --- src/script.cpp | 12 ++++++++++++ src/script.h | 10 +++++++--- 2 files changed, 19 insertions(+), 3 deletions(-) diff --git a/src/script.cpp b/src/script.cpp index 6b8e163..570e8a4 100644 --- a/src/script.cpp +++ b/src/script.cpp @@ -1248,6 +1248,8 @@ bool Solver(const CScript& scriptPubKey, txnouttype& typeRet, vector= 1 && scriptPubKey[0] == OP_RETURN && scriptPubKey.IsPushOnly(scriptPubKey.begin()+1)) { + typeRet = TX_NULL_DATA; + return true; + } + // Scan templates const CScript& script1 = scriptPubKey; BOOST_FOREACH(const PAIRTYPE(txnouttype, CScript)& tplate, mTemplates) diff --git a/src/script.h b/src/script.h index e9afde8..a99bcbc 100644 --- a/src/script.h +++ b/src/script.h @@ -540,10 +540,8 @@ public: bool IsPayToScriptHash() const; - // Called by CTransaction::IsStandard and P2SH VerifyScript (which makes it consensus-critical). - bool IsPushOnly() const + bool IsPushOnly(const_iterator pc) const { - const_iterator pc = begin(); while (pc < end()) { opcodetype opcode; @@ -555,6 +553,12 @@ public: return true; } + // Called by CTransaction::IsStandard and P2SH VerifyScript (which makes it consensus-critical). + bool IsPushOnly() const + { + return this->IsPushOnly(begin()); + } + // Called by CTransaction::IsStandard. bool HasCanonicalPushes() const; -- 1.7.1