@@ -21,7 +21,7 @@ use bitcoin::hash_types::Txid;
21
21
use bitcoin:: secp256k1:: { SecretKey , PublicKey } ;
22
22
23
23
use crate :: ln:: PaymentPreimage ;
24
- use crate :: ln:: chan_utils:: { TxCreationKeys , HTLCOutputInCommitment } ;
24
+ use crate :: ln:: chan_utils:: { TxCreationKeys , HTLCOutputInCommitment , DelayedPaymentBasepoint } ;
25
25
use crate :: ln:: chan_utils;
26
26
use crate :: ln:: msgs:: DecodeError ;
27
27
use 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;
114
114
#[ derive( Clone , PartialEq , Eq ) ]
115
115
pub ( crate ) struct RevokedOutput {
116
116
per_commitment_point : PublicKey ,
117
- counterparty_delayed_payment_base_key : PublicKey ,
117
+ counterparty_delayed_payment_base_key : DelayedPaymentBasepoint ,
118
118
counterparty_htlc_base_key : PublicKey ,
119
119
per_commitment_key : SecretKey ,
120
120
weight : u64 ,
@@ -124,7 +124,7 @@ pub(crate) struct RevokedOutput {
124
124
}
125
125
126
126
impl 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 {
128
128
RevokedOutput {
129
129
per_commitment_point,
130
130
counterparty_delayed_payment_base_key,
@@ -160,7 +160,7 @@ impl_writeable_tlv_based!(RevokedOutput, {
160
160
#[ derive( Clone , PartialEq , Eq ) ]
161
161
pub ( crate ) struct RevokedHTLCOutput {
162
162
per_commitment_point : PublicKey ,
163
- counterparty_delayed_payment_base_key : PublicKey ,
163
+ counterparty_delayed_payment_base_key : DelayedPaymentBasepoint ,
164
164
counterparty_htlc_base_key : PublicKey ,
165
165
per_commitment_key : SecretKey ,
166
166
weight : u64 ,
@@ -169,7 +169,7 @@ pub(crate) struct RevokedHTLCOutput {
169
169
}
170
170
171
171
impl 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 {
173
173
let weight = if htlc. offered { weight_revoked_offered_htlc ( channel_type_features) } else { weight_revoked_received_htlc ( channel_type_features) } ;
174
174
RevokedHTLCOutput {
175
175
per_commitment_point,
@@ -204,15 +204,15 @@ impl_writeable_tlv_based!(RevokedHTLCOutput, {
204
204
#[ derive( Clone , PartialEq , Eq ) ]
205
205
pub ( crate ) struct CounterpartyOfferedHTLCOutput {
206
206
per_commitment_point : PublicKey ,
207
- counterparty_delayed_payment_base_key : PublicKey ,
207
+ counterparty_delayed_payment_base_key : DelayedPaymentBasepoint ,
208
208
counterparty_htlc_base_key : PublicKey ,
209
209
preimage : PaymentPreimage ,
210
210
htlc : HTLCOutputInCommitment ,
211
211
channel_type_features : ChannelTypeFeatures ,
212
212
}
213
213
214
214
impl 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 {
216
216
CounterpartyOfferedHTLCOutput {
217
217
per_commitment_point,
218
218
counterparty_delayed_payment_base_key,
@@ -282,14 +282,14 @@ impl Readable for CounterpartyOfferedHTLCOutput {
282
282
#[ derive( Clone , PartialEq , Eq ) ]
283
283
pub ( crate ) struct CounterpartyReceivedHTLCOutput {
284
284
per_commitment_point : PublicKey ,
285
- counterparty_delayed_payment_base_key : PublicKey ,
285
+ counterparty_delayed_payment_base_key : DelayedPaymentBasepoint ,
286
286
counterparty_htlc_base_key : PublicKey ,
287
287
htlc : HTLCOutputInCommitment ,
288
288
channel_type_features : ChannelTypeFeatures ,
289
289
}
290
290
291
291
impl 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 {
293
293
CounterpartyReceivedHTLCOutput {
294
294
per_commitment_point,
295
295
counterparty_delayed_payment_base_key,
@@ -1190,6 +1190,7 @@ mod tests {
1190
1190
use crate :: chain:: Txid ;
1191
1191
use crate :: ln:: chan_utils:: HTLCOutputInCommitment ;
1192
1192
use crate :: ln:: { PaymentPreimage , PaymentHash } ;
1193
+ use crate :: ln:: chan_utils:: DelayedPaymentBasepoint ;
1193
1194
1194
1195
use bitcoin:: blockdata:: constants:: WITNESS_SCALE_FACTOR ;
1195
1196
use bitcoin:: blockdata:: script:: Script ;
@@ -1206,7 +1207,7 @@ mod tests {
1206
1207
{
1207
1208
let dumb_scalar = SecretKey :: from_slice( & hex:: decode( "0101010101010101010101010101010101010101010101010101010101010101" ) . unwrap( ) [ ..] ) . unwrap( ) ;
1208
1209
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) )
1210
1211
}
1211
1212
}
1212
1213
}
@@ -1218,7 +1219,7 @@ mod tests {
1218
1219
let dumb_point = PublicKey :: from_secret_key( & $secp_ctx, & dumb_scalar) ;
1219
1220
let hash = PaymentHash ( [ 1 ; 32 ] ) ;
1220
1221
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) )
1222
1223
}
1223
1224
}
1224
1225
}
@@ -1231,7 +1232,7 @@ mod tests {
1231
1232
let hash = PaymentHash ( [ 1 ; 32 ] ) ;
1232
1233
let preimage = PaymentPreimage ( [ 2 ; 32 ] ) ;
1233
1234
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) )
1235
1236
}
1236
1237
}
1237
1238
}
0 commit comments