Don't treat nulldata tx outs as nonstandard dust.

This commit modifies the dust check to exclude transactions with nulldata
outputs so they may be considered standard.
This commit is contained in:
Dave Collins 2015-01-11 14:43:25 -06:00
parent 22c85516e7
commit 4589d60212

View file

@ -286,7 +286,7 @@ func checkTransactionStandard(tx *btcutil.Tx, height int64) error {
} }
// None of the output public key scripts can be a non-standard script or // None of the output public key scripts can be a non-standard script or
// be "dust". // be "dust" (except when the script is a null data script).
numNullDataOutputs := 0 numNullDataOutputs := 0
for i, txOut := range msgTx.TxOut { for i, txOut := range msgTx.TxOut {
scriptClass := btcscript.GetScriptClass(txOut.PkScript) scriptClass := btcscript.GetScriptClass(txOut.PkScript)
@ -303,12 +303,12 @@ func checkTransactionStandard(tx *btcutil.Tx, height int64) error {
return txRuleError(rejectCode, str) return txRuleError(rejectCode, str)
} }
// Accumulate the number of outputs which only carry data. // Accumulate the number of outputs which only carry data. For
// all other script types, ensure the output value is not
// "dust".
if scriptClass == btcscript.NullDataTy { if scriptClass == btcscript.NullDataTy {
numNullDataOutputs++ numNullDataOutputs++
} } else if isDust(txOut) {
if isDust(txOut) {
str := fmt.Sprintf("transaction output %d: payment "+ str := fmt.Sprintf("transaction output %d: payment "+
"of %d is dust", i, txOut.Value) "of %d is dust", i, txOut.Value)
return txRuleError(btcwire.RejectDust, str) return txRuleError(btcwire.RejectDust, str)