get psbt inputs with bounds check

This commit is contained in:
Riccardo Casatta
2021-05-06 15:55:58 +02:00
parent 7961ae7f8e
commit 898dfe6cf1
2 changed files with 24 additions and 3 deletions

View File

@@ -61,6 +61,7 @@ use crate::descriptor::{
};
use crate::error::Error;
use crate::psbt::PsbtUtils;
use crate::signer::SignerError;
use crate::types::*;
const CACHE_ADDR_BATCH_SIZE: u32 = 100;
@@ -927,7 +928,10 @@ where
let mut finished = true;
for (n, input) in tx.input.iter().enumerate() {
let psbt_input = &psbt.inputs[n];
let psbt_input = &psbt
.inputs
.get(n)
.ok_or(Error::Signer(SignerError::InputIndexOutOfRange))?;
if psbt_input.final_script_sig.is_some() || psbt_input.final_script_witness.is_some() {
continue;
}