cryptocondition transaction is standard too
This commit is contained in:
@@ -223,6 +223,29 @@ bool CScript::IsPayToScriptHash() const
|
|||||||
this->at(22) == OP_EQUAL);
|
this->at(22) == OP_EQUAL);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool CScript::IsPayToCryptoCondition() const
|
||||||
|
{
|
||||||
|
const_iterator pc = this->begin();
|
||||||
|
vector<unsigned char> 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
|
bool CScript::IsPushOnly() const
|
||||||
{
|
{
|
||||||
const_iterator pc = begin();
|
const_iterator pc = begin();
|
||||||
|
|||||||
@@ -176,6 +176,7 @@ enum opcodetype
|
|||||||
OP_PUBKEYS = 0xfb,
|
OP_PUBKEYS = 0xfb,
|
||||||
OP_PUBKEYHASH = 0xfd,
|
OP_PUBKEYHASH = 0xfd,
|
||||||
OP_PUBKEY = 0xfe,
|
OP_PUBKEY = 0xfe,
|
||||||
|
OP_CRYPTOCONDITION = 0xfc,
|
||||||
|
|
||||||
OP_INVALIDOPCODE = 0xff,
|
OP_INVALIDOPCODE = 0xff,
|
||||||
};
|
};
|
||||||
@@ -563,6 +564,7 @@ public:
|
|||||||
unsigned int GetSigOpCount(const CScript& scriptSig) const;
|
unsigned int GetSigOpCount(const CScript& scriptSig) const;
|
||||||
|
|
||||||
bool IsPayToScriptHash() const;
|
bool IsPayToScriptHash() const;
|
||||||
|
bool IsPayToCryptoCondition() const;
|
||||||
|
|
||||||
/** Called by IsStandardTx and P2SH/BIP62 VerifyScript (which makes it consensus-critical). */
|
/** Called by IsStandardTx and P2SH/BIP62 VerifyScript (which makes it consensus-critical). */
|
||||||
bool IsPushOnly() const;
|
bool IsPushOnly() const;
|
||||||
|
|||||||
@@ -68,6 +68,13 @@ bool Solver(const CScript& scriptPubKey, txnouttype& typeRet, vector<vector<unsi
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Shortcut for pay-to-crypto-condition
|
||||||
|
if (scriptPubKey.IsPayToCryptoCondition()) {
|
||||||
|
typeRet = TX_CRYPTOCONDITION;
|
||||||
|
//vSolutionsRet.push_back("hello there");
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
// Scan templates
|
// Scan templates
|
||||||
const CScript& script1 = scriptPubKey;
|
const CScript& script1 = scriptPubKey;
|
||||||
BOOST_FOREACH(const PAIRTYPE(txnouttype, CScript)& tplate, mTemplates)
|
BOOST_FOREACH(const PAIRTYPE(txnouttype, CScript)& tplate, mTemplates)
|
||||||
|
|||||||
@@ -65,6 +65,7 @@ enum txnouttype
|
|||||||
TX_PUBKEYHASH,
|
TX_PUBKEYHASH,
|
||||||
TX_SCRIPTHASH,
|
TX_SCRIPTHASH,
|
||||||
TX_MULTISIG,
|
TX_MULTISIG,
|
||||||
|
TX_CRYPTOCONDITION,
|
||||||
TX_NULL_DATA,
|
TX_NULL_DATA,
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user