@@ -43,6 +43,7 @@ pub struct PsbtParams {
4343 pub ( crate ) locktime : Option < absolute:: LockTime > ,
4444 pub ( crate ) fallback_sequence : Option < Sequence > ,
4545 pub ( crate ) ordering : TxOrdering < Input , Output > ,
46+ pub ( crate ) only_witness_utxo : bool ,
4647}
4748
4849impl Default for PsbtParams {
@@ -66,6 +67,7 @@ impl Default for PsbtParams {
6667 locktime : Default :: default ( ) ,
6768 fallback_sequence : Default :: default ( ) ,
6869 ordering : Default :: default ( ) ,
70+ only_witness_utxo : Default :: default ( ) ,
6971 }
7072 }
7173}
@@ -239,6 +241,19 @@ impl PsbtParams {
239241 }
240242 self
241243 }
244+
245+ /// Only fill in the [`witness_utxo`] field of PSBT inputs which spends funds under segwit (v0).
246+ ///
247+ /// This allows opting out of including the [`non_witness_utxo`] for segwit spends. This reduces
248+ /// the size of the PSBT, however be aware that some signers might require the presence of the
249+ /// `non_witness_utxo`.
250+ ///
251+ /// [`witness_utxo`]: bitcoin::psbt::Input::witness_utxo
252+ /// [`non_witness_utxo`]: bitcoin::psbt::Input::non_witness_utxo
253+ pub fn only_witness_utxo ( & mut self ) -> & mut Self {
254+ self . only_witness_utxo = true ;
255+ self
256+ }
242257}
243258
244259/// Coin select strategy.
0 commit comments