Merge pull request #2738 from jgarzik/op_return

Relay OP_RETURN data TxOut as standard transaction type.
This commit is contained in:
Gavin Andresen
2013-10-21 22:47:24 -07:00
5 changed files with 56 additions and 10 deletions

View File

@@ -469,17 +469,28 @@ bool IsStandardTx(const CTransaction& tx, string& reason)
return false;
}
}
unsigned int nDataOut = 0;
txnouttype whichType;
BOOST_FOREACH(const CTxOut& txout, tx.vout) {
if (!::IsStandard(txout.scriptPubKey)) {
if (!::IsStandard(txout.scriptPubKey, whichType)) {
reason = "scriptpubkey";
return false;
}
if (txout.IsDust(CTransaction::nMinRelayTxFee)) {
if (whichType == TX_NULL_DATA)
nDataOut++;
else if (txout.IsDust(CTransaction::nMinRelayTxFee)) {
reason = "dust";
return false;
}
}
// only one OP_RETURN txout is permitted
if (nDataOut > 1) {
reason = "mucho-data";
return false;
}
return true;
}