@@ -21,7 +21,7 @@ use bitcoin::hash_types::Txid;
2121use bitcoin:: secp256k1:: { SecretKey , PublicKey } ;
2222
2323use crate :: ln:: PaymentPreimage ;
24- use crate :: ln:: chan_utils:: { TxCreationKeys , HTLCOutputInCommitment } ;
24+ use crate :: ln:: chan_utils:: { TxCreationKeys , HTLCOutputInCommitment , DelayedPaymentBasepoint } ;
2525use crate :: ln:: chan_utils;
2626use crate :: ln:: msgs:: DecodeError ;
2727use crate :: chain:: chaininterface:: { FeeEstimator , ConfirmationTarget , MIN_RELAY_FEE_SAT_PER_1000_WEIGHT , compute_feerate_sat_per_1000_weight, FEERATE_FLOOR_SATS_PER_KW } ;
@@ -114,7 +114,7 @@ const HIGH_FREQUENCY_BUMP_INTERVAL: u32 = 1;
114114#[ derive( Clone , PartialEq , Eq ) ]
115115pub ( crate ) struct RevokedOutput {
116116 per_commitment_point : PublicKey ,
117- counterparty_delayed_payment_base_key : PublicKey ,
117+ counterparty_delayed_payment_base_key : DelayedPaymentBasepoint ,
118118 counterparty_htlc_base_key : PublicKey ,
119119 per_commitment_key : SecretKey ,
120120 weight : u64 ,
@@ -124,7 +124,7 @@ pub(crate) struct RevokedOutput {
124124}
125125
126126impl RevokedOutput {
127- pub ( crate ) fn build ( per_commitment_point : PublicKey , counterparty_delayed_payment_base_key : PublicKey , counterparty_htlc_base_key : PublicKey , per_commitment_key : SecretKey , amount : u64 , on_counterparty_tx_csv : u16 , is_counterparty_balance_on_anchors : bool ) -> Self {
127+ pub ( crate ) fn build ( per_commitment_point : PublicKey , counterparty_delayed_payment_base_key : DelayedPaymentBasepoint , counterparty_htlc_base_key : PublicKey , per_commitment_key : SecretKey , amount : u64 , on_counterparty_tx_csv : u16 , is_counterparty_balance_on_anchors : bool ) -> Self {
128128 RevokedOutput {
129129 per_commitment_point,
130130 counterparty_delayed_payment_base_key,
@@ -160,7 +160,7 @@ impl_writeable_tlv_based!(RevokedOutput, {
160160#[ derive( Clone , PartialEq , Eq ) ]
161161pub ( crate ) struct RevokedHTLCOutput {
162162 per_commitment_point : PublicKey ,
163- counterparty_delayed_payment_base_key : PublicKey ,
163+ counterparty_delayed_payment_base_key : DelayedPaymentBasepoint ,
164164 counterparty_htlc_base_key : PublicKey ,
165165 per_commitment_key : SecretKey ,
166166 weight : u64 ,
@@ -169,7 +169,7 @@ pub(crate) struct RevokedHTLCOutput {
169169}
170170
171171impl RevokedHTLCOutput {
172- pub ( crate ) fn build ( per_commitment_point : PublicKey , counterparty_delayed_payment_base_key : PublicKey , counterparty_htlc_base_key : PublicKey , per_commitment_key : SecretKey , amount : u64 , htlc : HTLCOutputInCommitment , channel_type_features : & ChannelTypeFeatures ) -> Self {
172+ pub ( crate ) fn build ( per_commitment_point : PublicKey , counterparty_delayed_payment_base_key : DelayedPaymentBasepoint , counterparty_htlc_base_key : PublicKey , per_commitment_key : SecretKey , amount : u64 , htlc : HTLCOutputInCommitment , channel_type_features : & ChannelTypeFeatures ) -> Self {
173173 let weight = if htlc. offered { weight_revoked_offered_htlc ( channel_type_features) } else { weight_revoked_received_htlc ( channel_type_features) } ;
174174 RevokedHTLCOutput {
175175 per_commitment_point,
@@ -204,15 +204,15 @@ impl_writeable_tlv_based!(RevokedHTLCOutput, {
204204#[ derive( Clone , PartialEq , Eq ) ]
205205pub ( crate ) struct CounterpartyOfferedHTLCOutput {
206206 per_commitment_point : PublicKey ,
207- counterparty_delayed_payment_base_key : PublicKey ,
207+ counterparty_delayed_payment_base_key : DelayedPaymentBasepoint ,
208208 counterparty_htlc_base_key : PublicKey ,
209209 preimage : PaymentPreimage ,
210210 htlc : HTLCOutputInCommitment ,
211211 channel_type_features : ChannelTypeFeatures ,
212212}
213213
214214impl CounterpartyOfferedHTLCOutput {
215- pub ( crate ) fn build ( per_commitment_point : PublicKey , counterparty_delayed_payment_base_key : PublicKey , counterparty_htlc_base_key : PublicKey , preimage : PaymentPreimage , htlc : HTLCOutputInCommitment , channel_type_features : ChannelTypeFeatures ) -> Self {
215+ pub ( crate ) fn build ( per_commitment_point : PublicKey , counterparty_delayed_payment_base_key : DelayedPaymentBasepoint , counterparty_htlc_base_key : PublicKey , preimage : PaymentPreimage , htlc : HTLCOutputInCommitment , channel_type_features : ChannelTypeFeatures ) -> Self {
216216 CounterpartyOfferedHTLCOutput {
217217 per_commitment_point,
218218 counterparty_delayed_payment_base_key,
@@ -282,14 +282,14 @@ impl Readable for CounterpartyOfferedHTLCOutput {
282282#[ derive( Clone , PartialEq , Eq ) ]
283283pub ( crate ) struct CounterpartyReceivedHTLCOutput {
284284 per_commitment_point : PublicKey ,
285- counterparty_delayed_payment_base_key : PublicKey ,
285+ counterparty_delayed_payment_base_key : DelayedPaymentBasepoint ,
286286 counterparty_htlc_base_key : PublicKey ,
287287 htlc : HTLCOutputInCommitment ,
288288 channel_type_features : ChannelTypeFeatures ,
289289}
290290
291291impl CounterpartyReceivedHTLCOutput {
292- pub ( crate ) fn build ( per_commitment_point : PublicKey , counterparty_delayed_payment_base_key : PublicKey , counterparty_htlc_base_key : PublicKey , htlc : HTLCOutputInCommitment , channel_type_features : ChannelTypeFeatures ) -> Self {
292+ pub ( crate ) fn build ( per_commitment_point : PublicKey , counterparty_delayed_payment_base_key : DelayedPaymentBasepoint , counterparty_htlc_base_key : PublicKey , htlc : HTLCOutputInCommitment , channel_type_features : ChannelTypeFeatures ) -> Self {
293293 CounterpartyReceivedHTLCOutput {
294294 per_commitment_point,
295295 counterparty_delayed_payment_base_key,
@@ -1190,6 +1190,7 @@ mod tests {
11901190 use crate :: chain:: Txid ;
11911191 use crate :: ln:: chan_utils:: HTLCOutputInCommitment ;
11921192 use crate :: ln:: { PaymentPreimage , PaymentHash } ;
1193+ use crate :: ln:: chan_utils:: DelayedPaymentBasepoint ;
11931194
11941195 use bitcoin:: blockdata:: constants:: WITNESS_SCALE_FACTOR ;
11951196 use bitcoin:: blockdata:: script:: Script ;
@@ -1206,7 +1207,7 @@ mod tests {
12061207 {
12071208 let dumb_scalar = SecretKey :: from_slice( & hex:: decode( "0101010101010101010101010101010101010101010101010101010101010101" ) . unwrap( ) [ ..] ) . unwrap( ) ;
12081209 let dumb_point = PublicKey :: from_secret_key( & $secp_ctx, & dumb_scalar) ;
1209- PackageSolvingData :: RevokedOutput ( RevokedOutput :: build( dumb_point, dumb_point, dumb_point, dumb_scalar, 0 , 0 , $is_counterparty_balance_on_anchors) )
1210+ PackageSolvingData :: RevokedOutput ( RevokedOutput :: build( dumb_point, DelayedPaymentBasepoint :: from ( dumb_point) , dumb_point, dumb_scalar, 0 , 0 , $is_counterparty_balance_on_anchors) )
12101211 }
12111212 }
12121213 }
@@ -1218,7 +1219,7 @@ mod tests {
12181219 let dumb_point = PublicKey :: from_secret_key( & $secp_ctx, & dumb_scalar) ;
12191220 let hash = PaymentHash ( [ 1 ; 32 ] ) ;
12201221 let htlc = HTLCOutputInCommitment { offered: true , amount_msat: $amt, cltv_expiry: 0 , payment_hash: hash, transaction_output_index: None } ;
1221- PackageSolvingData :: CounterpartyReceivedHTLCOutput ( CounterpartyReceivedHTLCOutput :: build( dumb_point, dumb_point, dumb_point, htlc, $opt_anchors) )
1222+ PackageSolvingData :: CounterpartyReceivedHTLCOutput ( CounterpartyReceivedHTLCOutput :: build( dumb_point, DelayedPaymentBasepoint :: from ( dumb_point) , dumb_point, htlc, $opt_anchors) )
12221223 }
12231224 }
12241225 }
@@ -1231,7 +1232,7 @@ mod tests {
12311232 let hash = PaymentHash ( [ 1 ; 32 ] ) ;
12321233 let preimage = PaymentPreimage ( [ 2 ; 32 ] ) ;
12331234 let htlc = HTLCOutputInCommitment { offered: false , amount_msat: $amt, cltv_expiry: 1000 , payment_hash: hash, transaction_output_index: None } ;
1234- PackageSolvingData :: CounterpartyOfferedHTLCOutput ( CounterpartyOfferedHTLCOutput :: build( dumb_point, dumb_point, dumb_point, preimage, htlc, $opt_anchors) )
1235+ PackageSolvingData :: CounterpartyOfferedHTLCOutput ( CounterpartyOfferedHTLCOutput :: build( dumb_point, DelayedPaymentBasepoint :: from ( dumb_point) , dumb_point, preimage, htlc, $opt_anchors) )
12351236 }
12361237 }
12371238 }
0 commit comments