We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent db1eab4 commit 6b2f8ffCopy full SHA for 6b2f8ff
1 file changed
src/psbt/mod.rs
@@ -43,8 +43,15 @@ impl PsbtUtils for Psbt {
43
44
match (&input.witness_utxo, &input.non_witness_utxo) {
45
(Some(_), _) => input.witness_utxo.clone(),
46
- (_, Some(_)) => input.non_witness_utxo.as_ref().map(|in_tx| {
47
- in_tx.output[tx.input[input_index].previous_output.vout as usize].clone()
+ (_, Some(_)) => input.non_witness_utxo.as_ref().and_then(|in_tx| {
+ // Validate that the non_witness_utxo txid matches the input's previous output txid
48
+ if in_tx.compute_txid() != tx.input[input_index].previous_output.txid {
49
+ return None;
50
+ }
51
+ in_tx
52
+ .output
53
+ .get(tx.input[input_index].previous_output.vout as usize)
54
+ .cloned()
55
}),
56
_ => None,
57
}
0 commit comments