diff options
| author | Pieter Wuille <[email protected]> | 2018-08-23 17:01:14 -0700 |
|---|---|---|
| committer | Pieter Wuille <[email protected]> | 2018-08-23 17:15:29 -0700 |
| commit | bb530efa1872ec963417f61da9a95185c7a7a7d6 (patch) | |
| tree | 8dd7c2d658a7d4a51863ceb48fe7de7e00344e14 | |
| parent | Merge #12559: Avoid locking cs_main in some wallet RPC (diff) | |
| download | discoin-bb530efa1872ec963417f61da9a95185c7a7a7d6.tar.xz discoin-bb530efa1872ec963417f61da9a95185c7a7a7d6.zip | |
Disallow extended encoding for non-witness transactions
| -rw-r--r-- | src/primitives/transaction.h | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/src/primitives/transaction.h b/src/primitives/transaction.h index fb9db508d..c1568f9b2 100644 --- a/src/primitives/transaction.h +++ b/src/primitives/transaction.h @@ -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 */ |