@@ -1111,6 +1111,11 @@ pub struct ChannelDetails {
1111
1111
/// inbound. This may be zero for inbound channels serialized with LDK versions prior to
1112
1112
/// 0.0.113.
1113
1113
pub user_channel_id : u128 ,
1114
+ /// The currently negotiated fee rate denominated in satoshi per 1000 weight units,
1115
+ /// which is applied to commitment and HTLC transactions.
1116
+ ///
1117
+ /// This value will be `None` for objects serialized with LDK versions prior to 0.0.115.
1118
+ pub feerate_sat_per_1000_weight : Option < u32 > ,
1114
1119
/// Our total balance. This is the amount we would get if we close the channel.
1115
1120
/// This value is not exact. Due to various in-flight changes and feerate changes, exactly this
1116
1121
/// amount is not likely to be recoverable on close.
@@ -1253,6 +1258,7 @@ impl ChannelDetails {
1253
1258
outbound_scid_alias : if channel. is_usable ( ) { Some ( channel. outbound_scid_alias ( ) ) } else { None } ,
1254
1259
inbound_scid_alias : channel. latest_inbound_scid_alias ( ) ,
1255
1260
channel_value_satoshis : channel. get_value_satoshis ( ) ,
1261
+ feerate_sat_per_1000_weight : Some ( channel. get_feerate_sat_per_1000_weight ( ) ) ,
1256
1262
unspendable_punishment_reserve : to_self_reserve_satoshis,
1257
1263
balance_msat : balance. balance_msat ,
1258
1264
inbound_capacity_msat : balance. inbound_capacity_msat ,
@@ -3492,18 +3498,18 @@ where
3492
3498
fn update_channel_fee ( & self , chan_id : & [ u8 ; 32 ] , chan : & mut Channel < <SP :: Target as SignerProvider >:: Signer > , new_feerate : u32 ) -> NotifyOption {
3493
3499
if !chan. is_outbound ( ) { return NotifyOption :: SkipPersist ; }
3494
3500
// If the feerate has decreased by less than half, don't bother
3495
- if new_feerate <= chan. get_feerate ( ) && new_feerate * 2 > chan. get_feerate ( ) {
3501
+ if new_feerate <= chan. get_feerate_sat_per_1000_weight ( ) && new_feerate * 2 > chan. get_feerate_sat_per_1000_weight ( ) {
3496
3502
log_trace ! ( self . logger, "Channel {} does not qualify for a feerate change from {} to {}." ,
3497
- log_bytes!( chan_id[ ..] ) , chan. get_feerate ( ) , new_feerate) ;
3503
+ log_bytes!( chan_id[ ..] ) , chan. get_feerate_sat_per_1000_weight ( ) , new_feerate) ;
3498
3504
return NotifyOption :: SkipPersist ;
3499
3505
}
3500
3506
if !chan. is_live ( ) {
3501
3507
log_trace ! ( self . logger, "Channel {} does not qualify for a feerate change from {} to {} as it cannot currently be updated (probably the peer is disconnected)." ,
3502
- log_bytes!( chan_id[ ..] ) , chan. get_feerate ( ) , new_feerate) ;
3508
+ log_bytes!( chan_id[ ..] ) , chan. get_feerate_sat_per_1000_weight ( ) , new_feerate) ;
3503
3509
return NotifyOption :: SkipPersist ;
3504
3510
}
3505
3511
log_trace ! ( self . logger, "Channel {} qualifies for a feerate change from {} to {}." ,
3506
- log_bytes!( chan_id[ ..] ) , chan. get_feerate ( ) , new_feerate) ;
3512
+ log_bytes!( chan_id[ ..] ) , chan. get_feerate_sat_per_1000_weight ( ) , new_feerate) ;
3507
3513
3508
3514
chan. queue_update_fee ( new_feerate, & self . logger ) ;
3509
3515
NotifyOption :: DoPersist
@@ -6562,6 +6568,7 @@ impl Writeable for ChannelDetails {
6562
6568
( 33 , self . inbound_htlc_minimum_msat, option) ,
6563
6569
( 35 , self . inbound_htlc_maximum_msat, option) ,
6564
6570
( 37 , user_channel_id_high_opt, option) ,
6571
+ ( 39 , self . feerate_sat_per_1000_weight, option) ,
6565
6572
} ) ;
6566
6573
Ok ( ( ) )
6567
6574
}
@@ -6597,6 +6604,7 @@ impl Readable for ChannelDetails {
6597
6604
( 33 , inbound_htlc_minimum_msat, option) ,
6598
6605
( 35 , inbound_htlc_maximum_msat, option) ,
6599
6606
( 37 , user_channel_id_high_opt, option) ,
6607
+ ( 39 , feerate_sat_per_1000_weight, option) ,
6600
6608
} ) ;
6601
6609
6602
6610
// `user_channel_id` used to be a single u64 value. In order to remain backwards compatible with
@@ -6630,6 +6638,7 @@ impl Readable for ChannelDetails {
6630
6638
is_public : is_public. 0 . unwrap ( ) ,
6631
6639
inbound_htlc_minimum_msat,
6632
6640
inbound_htlc_maximum_msat,
6641
+ feerate_sat_per_1000_weight,
6633
6642
} )
6634
6643
}
6635
6644
}
0 commit comments