File tree Expand file tree Collapse file tree 1 file changed +5
-1
lines changed Expand file tree Collapse file tree 1 file changed +5
-1
lines changed Original file line number Diff line number Diff line change @@ -2211,8 +2211,12 @@ impl Wallet {
22112211
22122212 let prev_output = utxo. outpoint ;
22132213 if let Some ( prev_tx) = self . indexed_graph . graph ( ) . get_tx ( prev_output. txid ) {
2214+ // We want to check that the prevout actually exists in the tx before continuing.
2215+ let prevout = prev_tx. output . get ( prev_output. vout as usize ) . ok_or (
2216+ MiniscriptPsbtError :: UtxoUpdate ( miniscript:: psbt:: UtxoUpdateError :: UtxoCheck ) ,
2217+ ) ?;
22142218 if desc. is_witness ( ) || desc. is_taproot ( ) {
2215- psbt_input. witness_utxo = Some ( prev_tx . output [ prev_output . vout as usize ] . clone ( ) ) ;
2219+ psbt_input. witness_utxo = Some ( prevout . clone ( ) ) ;
22162220 }
22172221 if !desc. is_taproot ( ) && ( !desc. is_witness ( ) || !only_witness_utxo) {
22182222 psbt_input. non_witness_utxo = Some ( prev_tx. as_ref ( ) . clone ( ) ) ;
You can’t perform that action at this time.
0 commit comments