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