File tree 1 file changed +17
-0
lines changed
1 file changed +17
-0
lines changed Original file line number Diff line number Diff line change @@ -133,6 +133,23 @@ pub struct StaticPaymentOutputDescriptor {
133
133
pub channel_transaction_parameters : Option < ChannelTransactionParameters > ,
134
134
}
135
135
impl StaticPaymentOutputDescriptor {
136
+ /// Returns the `witness_script` of the spendable output.
137
+ ///
138
+ /// Note that this will only return some for [`StaticPaymentOutputDescriptor`]s that originated
139
+ /// from an anchor outputs channel, as they take the form of a P2WSH script.
140
+ pub fn witness_script ( & self ) -> Option < Script > {
141
+ self . channel_transaction_parameters . as_ref ( )
142
+ . map ( |channel_params|
143
+ if channel_params. channel_type_features . supports_anchors_zero_fee_htlc_tx ( ) {
144
+ let payment_point = channel_params. as_holder_broadcastable ( ) . broadcaster_pubkeys ( ) . payment_point ;
145
+ Some ( chan_utils:: get_to_countersignatory_with_anchors_redeemscript ( & payment_point) )
146
+ } else {
147
+ None
148
+ }
149
+ )
150
+ . flatten ( )
151
+ }
152
+
136
153
/// The maximum length a well-formed witness spending one of these should have.
137
154
/// Note: If you have the grind_signatures feature enabled, this will be at least 1 byte
138
155
/// shorter.
You can’t perform that action at this time.
0 commit comments