diff options
| author | Pieter Wuille <[email protected]> | 2018-08-23 17:01:14 -0700 |
|---|---|---|
| committer | MarcoFalke <[email protected]> | 2019-05-20 12:23:45 -0400 |
| commit | 206f5ee87576d619ea9d09380cc4d205989c7885 (patch) | |
| tree | 272c136d537766293c4f3ead6a1158407b169b73 /src/primitives | |
| parent | Show loaded wallets as disabled in open menu instead of nothing (diff) | |
| download | discoin-206f5ee87576d619ea9d09380cc4d205989c7885.tar.xz discoin-206f5ee87576d619ea9d09380cc4d205989c7885.zip | |
Disallow extended encoding for non-witness transactions
Github-Pull: #14039
Rebased-From: bb530efa1872ec963417f61da9a95185c7a7a7d6
Diffstat (limited to 'src/primitives')
| -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 f6f8e3136..aad991e2f 100644 --- a/src/primitives/transaction.h +++ b/src/primitives/transaction.h @@ -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 */ |