Disallow coinbase output witness data, since outputs are explicit anyways

This commit is contained in:
Gregory Sanders 2019-03-25 09:55:32 -04:00
parent 8b2e8859d6
commit 2cb47d1705
2 changed files with 10 additions and 3 deletions

View file

@ -406,6 +406,14 @@ bool VerifyAmounts(const std::vector<CTxOut>& inputs, const CTransaction& tx, st
bool VerifyCoinbaseAmount(const CTransaction& tx, const CAmountMap& mapFees) {
assert(tx.IsCoinBase());
// Miner shouldn't be stuffing witness data
for (const auto& outwit : tx.witness.vtxoutwit) {
if (!outwit.IsNull()) {
return false;
}
}
CAmountMap remaining = mapFees;
for (unsigned int i = 0; i < tx.vout.size(); i++) {
const CTxOut& out = tx.vout[i];