Skip to content

Commit

Permalink
Disallow extended encoding for non-witness transactions
Browse files Browse the repository at this point in the history
  • Loading branch information
sipa committed Aug 24, 2018
1 parent 540bf8a commit bb530ef
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions src/primitives/transaction.h
Original file line number Diff line number Diff line change
Expand Up @@ -220,6 +220,10 @@ inline void UnserializeTransaction(TxType& tx, Stream& s) {
for (size_t i = 0; i < tx.vin.size(); i++) {
s >> tx.vin[i].scriptWitness.stack;
}
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 */
Expand Down

0 comments on commit bb530ef

Please sign in to comment.