Disallow extended encoding for non-witness transactions

This commit is contained in:
Pieter Wuille 2018-08-23 17:01:14 -07:00 committed by Andrew Poelstra
parent 929be38305
commit 8719c94c33

View file

@ -654,6 +654,10 @@ inline void UnserializeTransaction(TxType& tx, Stream& s) {
const_cast<CTxWitness*>(&tx.wit)->vtxinwit.resize(tx.vin.size());
const_cast<CTxWitness*>(&tx.wit)->vtxoutwit.resize(tx.vout.size());
s >> tx.wit;
if (!tx.HasWitness()) {
/* It's illegal to encode witnesses when all witness stacks are empty. */
throw std::ios_base::failure("Superfluous witness record");
}
}
if (flags) {
/* Unknown flag in the serialization */