Make sure transactions have non-empty outputs

This commit is contained in:
Eirik Ogilvie-Wigley
2018-04-26 15:24:59 -06:00
parent a2ff78620a
commit 4b4662b06d
2 changed files with 18 additions and 3 deletions

View File

@@ -1039,12 +1039,14 @@ bool CheckTransactionWithoutProofVerification(const CTransaction& tx, CValidatio
}
}
// Transactions can contain empty `vin` and `vout` so long as
// either `vjoinsplit` or `vShieldedSpend` are non-empty.
// Transactions containing empty `vin` must have either non-empty
// `vjoinsplit` or non-empty `vShieldedSpend`.
if (tx.vin.empty() && tx.vjoinsplit.empty() && tx.vShieldedSpend.empty())
return state.DoS(10, error("CheckTransaction(): vin empty"),
REJECT_INVALID, "bad-txns-vin-empty");
if (tx.vout.empty() && tx.vjoinsplit.empty() && tx.vShieldedSpend.empty())
// Transactions containing empty `vout` must have either non-empty
// `vjoinsplit` or non-empty `vShieldedOutput`.
if (tx.vout.empty() && tx.vjoinsplit.empty() && tx.vShieldedOutput.empty())
return state.DoS(10, error("CheckTransaction(): vout empty"),
REJECT_INVALID, "bad-txns-vout-empty");