@@ -1111,6 +1111,11 @@ pub struct ChannelDetails {
11111111 /// inbound. This may be zero for inbound channels serialized with LDK versions prior to
11121112 /// 0.0.113.
11131113 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 > ,
11141119 /// Our total balance. This is the amount we would get if we close the channel.
11151120 /// This value is not exact. Due to various in-flight changes and feerate changes, exactly this
11161121 /// amount is not likely to be recoverable on close.
@@ -1253,6 +1258,7 @@ impl ChannelDetails {
12531258 outbound_scid_alias : if channel. is_usable ( ) { Some ( channel. outbound_scid_alias ( ) ) } else { None } ,
12541259 inbound_scid_alias : channel. latest_inbound_scid_alias ( ) ,
12551260 channel_value_satoshis : channel. get_value_satoshis ( ) ,
1261+ feerate_sat_per_1000_weight : Some ( channel. get_feerate_sat_per_1000_weight ( ) ) ,
12561262 unspendable_punishment_reserve : to_self_reserve_satoshis,
12571263 balance_msat : balance. balance_msat ,
12581264 inbound_capacity_msat : balance. inbound_capacity_msat ,
@@ -3492,18 +3498,18 @@ where
34923498 fn update_channel_fee ( & self , chan_id : & [ u8 ; 32 ] , chan : & mut Channel < <SP :: Target as SignerProvider >:: Signer > , new_feerate : u32 ) -> NotifyOption {
34933499 if !chan. is_outbound ( ) { return NotifyOption :: SkipPersist ; }
34943500 // 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 ( ) {
34963502 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) ;
34983504 return NotifyOption :: SkipPersist ;
34993505 }
35003506 if !chan. is_live ( ) {
35013507 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) ;
35033509 return NotifyOption :: SkipPersist ;
35043510 }
35053511 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) ;
35073513
35083514 chan. queue_update_fee ( new_feerate, & self . logger ) ;
35093515 NotifyOption :: DoPersist
@@ -6562,6 +6568,7 @@ impl Writeable for ChannelDetails {
65626568 ( 33 , self . inbound_htlc_minimum_msat, option) ,
65636569 ( 35 , self . inbound_htlc_maximum_msat, option) ,
65646570 ( 37 , user_channel_id_high_opt, option) ,
6571+ ( 39 , self . feerate_sat_per_1000_weight, option) ,
65656572 } ) ;
65666573 Ok ( ( ) )
65676574 }
@@ -6597,6 +6604,7 @@ impl Readable for ChannelDetails {
65976604 ( 33 , inbound_htlc_minimum_msat, option) ,
65986605 ( 35 , inbound_htlc_maximum_msat, option) ,
65996606 ( 37 , user_channel_id_high_opt, option) ,
6607+ ( 39 , feerate_sat_per_1000_weight, option) ,
66006608 } ) ;
66016609
66026610 // `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 {
66306638 is_public : is_public. 0 . unwrap ( ) ,
66316639 inbound_htlc_minimum_msat,
66326640 inbound_htlc_maximum_msat,
6641+ feerate_sat_per_1000_weight,
66336642 } )
66346643 }
66356644}
0 commit comments