@@ -950,6 +950,12 @@ pub trait ChannelSigner {
950950 /// Gets the weight of the witness of the input that spends the htlc output of a
951951 /// holder commitment transaction
952952 fn get_holder_htlc_transaction_witness_weight ( & self , offered : bool ) -> u64 ;
953+
954+ /// Gets the script pubkey of a htlc output in a commitment transaction
955+ fn get_htlc_spk (
956+ & self , htlc : & HTLCOutputInCommitment , is_holder_tx : bool , per_commitment_point : & PublicKey ,
957+ secp_ctx : & Secp256k1 < secp256k1:: All > ,
958+ ) -> ScriptBuf ;
953959}
954960
955961/// Specifies the recipient of an invoice.
@@ -1780,6 +1786,24 @@ impl ChannelSigner for InMemorySigner {
17801786 chan_utils:: HTLC_TIMEOUT_INPUT_ANCHOR_WITNESS_WEIGHT
17811787 }
17821788 }
1789+
1790+ fn get_htlc_spk (
1791+ & self , htlc : & HTLCOutputInCommitment , is_holder_tx : bool , per_commitment_point : & PublicKey ,
1792+ secp_ctx : & Secp256k1 < secp256k1:: All > ,
1793+ ) -> ScriptBuf {
1794+ let params = if is_holder_tx {
1795+ self . channel_parameters . as_ref ( ) . unwrap ( ) . as_holder_broadcastable ( )
1796+ } else {
1797+ self . channel_parameters . as_ref ( ) . unwrap ( ) . as_counterparty_broadcastable ( )
1798+ } ;
1799+ let keys = TxCreationKeys :: from_channel_static_keys (
1800+ per_commitment_point,
1801+ params. broadcaster_pubkeys ( ) ,
1802+ params. countersignatory_pubkeys ( ) ,
1803+ secp_ctx,
1804+ ) ;
1805+ chan_utils:: get_htlc_redeemscript ( htlc, params. channel_type_features ( ) , & keys) . to_p2wsh ( )
1806+ }
17831807}
17841808
17851809const MISSING_PARAMS_ERR : & ' static str =
0 commit comments