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 {
2211
2211
2212
2212
let prev_output = utxo. outpoint ;
2213
2213
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
+ ) ?;
2214
2218
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 ( ) ) ;
2216
2220
}
2217
2221
if !desc. is_taproot ( ) && ( !desc. is_witness ( ) || !only_witness_utxo) {
2218
2222
psbt_input. non_witness_utxo = Some ( prev_tx. as_ref ( ) . clone ( ) ) ;
You can’t perform that action at this time.
0 commit comments