transaction: reject transactions with Segwit byte set but no witnesses
This commit is contained in:
parent
d1d3b3fb02
commit
f0221fb79b
|
@ -408,12 +408,16 @@ impl<D: SimpleDecoder> ConsensusDecodable<D> for Transaction {
|
||||||
for txin in input.iter_mut() {
|
for txin in input.iter_mut() {
|
||||||
txin.witness = ConsensusDecodable::consensus_decode(d)?;
|
txin.witness = ConsensusDecodable::consensus_decode(d)?;
|
||||||
}
|
}
|
||||||
Ok(Transaction {
|
if !input.is_empty() && input.iter().all(|input| input.witness.is_empty()) {
|
||||||
version: version,
|
Err(serialize::Error::ParseFailed("witness flag set but no witnesses present"))
|
||||||
input: input,
|
} else {
|
||||||
output: output,
|
Ok(Transaction {
|
||||||
lock_time: ConsensusDecodable::consensus_decode(d)?,
|
version: version,
|
||||||
})
|
input: input,
|
||||||
|
output: output,
|
||||||
|
lock_time: ConsensusDecodable::consensus_decode(d)?,
|
||||||
|
})
|
||||||
|
}
|
||||||
}
|
}
|
||||||
// We don't support anything else
|
// We don't support anything else
|
||||||
x => {
|
x => {
|
||||||
|
|
Loading…
Reference in New Issue