Skip to content

Commit

Permalink
Disallow extended encoding for non-witness transactions
Browse files Browse the repository at this point in the history
Github-Pull: bitcoin#14039
Rebased-From: bb530ef
  • Loading branch information
sipa authored and MarcoFalke committed May 20, 2019
1 parent 3dbc7de commit 206f5ee
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions src/primitives/transaction.h
Expand Up @@ -222,6 +222,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 206f5ee

Please sign in to comment.