From: Alekos Filini Date: Thu, 6 May 2021 09:35:58 +0000 (+0200) Subject: Rewrite the `non_witness_utxo` check X-Git-Tag: v0.7.0~9 X-Git-Url: http://internal-gitweb-vhost/script/%22https:/database/-sqlite/static/gitweb.css?a=commitdiff_plain;h=3c7bae9ce9ecd02f18bd392202e3ac9e3af9c6b3;p=bdk Rewrite the `non_witness_utxo` check --- diff --git a/src/wallet/mod.rs b/src/wallet/mod.rs index 98be9338..4ddd7d36 100644 --- a/src/wallet/mod.rs +++ b/src/wallet/mod.rs @@ -862,12 +862,10 @@ where // If we aren't allowed to use `witness_utxo`, ensure that every input has the // `non_witness_utxo` - if !sign_options.trust_witness_utxo { - for input in &psbt.inputs { - if input.non_witness_utxo.is_none() { - return Err(Error::Signer(signer::SignerError::MissingNonWitnessUtxo)); - } - } + if !sign_options.trust_witness_utxo + && psbt.inputs.iter().any(|i| i.non_witness_utxo.is_none()) + { + return Err(Error::Signer(signer::SignerError::MissingNonWitnessUtxo)); } for signer in self