mirror of
https://github.com/bitcoin/bitcoin.git
synced 2026-01-20 07:09:15 +01:00
Disallow extended encoding for non-witness transactions
Github-Pull: #14039
Rebased-From: bb530efa18
This commit is contained in:
committed by
MarcoFalke
parent
3dbc7def0f
commit
206f5ee875
@@ -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 */
|
||||
|
||||
Reference in New Issue
Block a user