From: CryptoManiac Date: Sun, 21 Feb 2016 18:06:08 +0000 (+0300) Subject: Simplify OP_RETURN handling. X-Git-Tag: nvc-v0.5.6~60 X-Git-Url: https://git.novaco.in/?p=novacoin.git;a=commitdiff_plain;h=db034013fa0c48c71629f7e92353c01a7c2fc0f2 Simplify OP_RETURN handling. --- 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;