Skip to content

Commit 8611c3a

Browse files
committed
feat(selection): Add member PsbtParams::sighash_type
1 parent ac547ce commit 8611c3a

File tree

1 file changed

+12
-0
lines changed

1 file changed

+12
-0
lines changed

src/selection.rs

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,14 @@ pub struct PsbtParams {
4444
///
4545
/// [`non_witness_utxo`]: bitcoin::psbt::Input::non_witness_utxo
4646
pub mandate_full_tx_for_segwit_v0: bool,
47+
48+
/// Sighash type to be used for each input.
49+
///
50+
/// This option only applies to [`Input`]s that include a plan, as otherwise the given PSBT
51+
/// input can be expected to set a specific sighash type. Defaults to `None` which will not
52+
/// set an explicit sighash type for any input. (In that case the sighash will typically
53+
/// cover all of the outputs).
54+
pub sighash_type: Option<bitcoin::psbt::PsbtSighashType>,
4755
}
4856

4957
impl Default for PsbtParams {
@@ -53,6 +61,7 @@ impl Default for PsbtParams {
5361
fallback_locktime: absolute::LockTime::ZERO,
5462
fallback_sequence: FALLBACK_SEQUENCE,
5563
mandate_full_tx_for_segwit_v0: true,
64+
sighash_type: None,
5665
}
5766
}
5867
}
@@ -179,6 +188,9 @@ impl Selection {
179188
));
180189
}
181190
}
191+
192+
psbt_input.sighash_type = params.sighash_type;
193+
182194
continue;
183195
}
184196
unreachable!("input candidate must either have finalized psbt input or plan");

0 commit comments

Comments
 (0)