diff --git a/src/script/script.cpp b/src/script/script.cpp index 3cb3f855d..a78bd7e29 100644 --- a/src/script/script.cpp +++ b/src/script/script.cpp @@ -223,6 +223,29 @@ bool CScript::IsPayToScriptHash() const this->at(22) == OP_EQUAL); } +bool CScript::IsPayToCryptoCondition() const +{ + const_iterator pc = this->begin(); + vector data; + int i; + while (pc < this->end()) + { + opcodetype opcode; + if (!this->GetOp(pc, opcode, data)) + return 0; + if (0 == i) + if (opcode != OP_PUSHDATA1) + return 0; + if (1 == i) + if (opcode != OP_CHECKCRYPTOCONDITION) + return 0; + if (i > 1) + return 0; + i++; + } + return 1; +} + bool CScript::IsPushOnly() const { const_iterator pc = begin(); diff --git a/src/script/script.h b/src/script/script.h index 584fefac1..800289a15 100644 --- a/src/script/script.h +++ b/src/script/script.h @@ -176,6 +176,7 @@ enum opcodetype OP_PUBKEYS = 0xfb, OP_PUBKEYHASH = 0xfd, OP_PUBKEY = 0xfe, + OP_CRYPTOCONDITION = 0xfc, OP_INVALIDOPCODE = 0xff, }; @@ -563,6 +564,7 @@ public: unsigned int GetSigOpCount(const CScript& scriptSig) const; bool IsPayToScriptHash() const; + bool IsPayToCryptoCondition() const; /** Called by IsStandardTx and P2SH/BIP62 VerifyScript (which makes it consensus-critical). */ bool IsPushOnly() const; diff --git a/src/script/standard.cpp b/src/script/standard.cpp index 71838853d..c304840f4 100644 --- a/src/script/standard.cpp +++ b/src/script/standard.cpp @@ -68,6 +68,13 @@ bool Solver(const CScript& scriptPubKey, txnouttype& typeRet, vector