@@ -952,6 +952,12 @@ pub trait ChannelSigner {
952952 /// Gets the weight of the witness of the input that spends the htlc output of a
953953 /// holder commitment transaction
954954 fn get_holder_htlc_transaction_witness_weight ( & self , offered : bool ) -> u64 ;
955+
956+ /// Gets the script pubkey of a htlc output in a commitment transaction
957+ fn get_htlc_spk (
958+ & self , htlc : & HTLCOutputInCommitment , is_holder_tx : bool , per_commitment_point : & PublicKey ,
959+ secp_ctx : & Secp256k1 < secp256k1:: All > ,
960+ ) -> ScriptBuf ;
955961}
956962
957963/// Specifies the recipient of an invoice.
@@ -1812,6 +1818,25 @@ impl ChannelSigner for InMemorySigner {
18121818 chan_utils:: HTLC_TIMEOUT_INPUT_ANCHOR_WITNESS_WEIGHT
18131819 }
18141820 }
1821+
1822+ fn get_htlc_spk (
1823+ & self , htlc : & HTLCOutputInCommitment , is_holder_tx : bool , per_commitment_point : & PublicKey ,
1824+ secp_ctx : & Secp256k1 < secp256k1:: All > ,
1825+ ) -> ScriptBuf {
1826+ let params = if is_holder_tx {
1827+ self . channel_parameters . as_ref ( ) . unwrap ( ) . as_holder_broadcastable ( )
1828+ } else {
1829+ self . channel_parameters . as_ref ( ) . unwrap ( ) . as_counterparty_broadcastable ( )
1830+ } ;
1831+ let keys = TxCreationKeys :: from_channel_static_keys (
1832+ per_commitment_point,
1833+ params. broadcaster_pubkeys ( ) ,
1834+ params. countersignatory_pubkeys ( ) ,
1835+ secp_ctx,
1836+ ) ;
1837+ let script = chan_utils:: get_htlc_redeemscript ( htlc, params. channel_type_features ( ) , & keys) ;
1838+ script. to_p2wsh ( )
1839+ }
18151840}
18161841
18171842const MISSING_PARAMS_ERR : & ' static str =
0 commit comments