@@ -1118,6 +1118,11 @@ pub struct ChannelDetails {
11181118 /// inbound. This may be zero for inbound channels serialized with LDK versions prior to
11191119 /// 0.0.113.
11201120 pub user_channel_id : u128 ,
1121+ /// The currently negotiated fee rate denominated in satoshi per 1000 weight units,
1122+ /// which is applied to commitment and HTLC transactions.
1123+ ///
1124+ /// This value will be `None` for objects serialized with LDK versions prior to 0.0.115.
1125+ pub feerate_sat_per_1000_weight : Option < u32 > ,
11211126 /// Our total balance. This is the amount we would get if we close the channel.
11221127 /// This value is not exact. Due to various in-flight changes and feerate changes, exactly this
11231128 /// amount is not likely to be recoverable on close.
@@ -1260,6 +1265,7 @@ impl ChannelDetails {
12601265 outbound_scid_alias : if channel. is_usable ( ) { Some ( channel. outbound_scid_alias ( ) ) } else { None } ,
12611266 inbound_scid_alias : channel. latest_inbound_scid_alias ( ) ,
12621267 channel_value_satoshis : channel. get_value_satoshis ( ) ,
1268+ feerate_sat_per_1000_weight : Some ( channel. get_feerate_sat_per_1000_weight ( ) ) ,
12631269 unspendable_punishment_reserve : to_self_reserve_satoshis,
12641270 balance_msat : balance. balance_msat ,
12651271 inbound_capacity_msat : balance. inbound_capacity_msat ,
@@ -3500,18 +3506,18 @@ where
35003506 fn update_channel_fee ( & self , chan_id : & [ u8 ; 32 ] , chan : & mut Channel < <SP :: Target as SignerProvider >:: Signer > , new_feerate : u32 ) -> NotifyOption {
35013507 if !chan. is_outbound ( ) { return NotifyOption :: SkipPersist ; }
35023508 // If the feerate has decreased by less than half, don't bother
3503- if new_feerate <= chan. get_feerate ( ) && new_feerate * 2 > chan. get_feerate ( ) {
3509+ if new_feerate <= chan. get_feerate_sat_per_1000_weight ( ) && new_feerate * 2 > chan. get_feerate_sat_per_1000_weight ( ) {
35043510 log_trace ! ( self . logger, "Channel {} does not qualify for a feerate change from {} to {}." ,
3505- log_bytes!( chan_id[ ..] ) , chan. get_feerate ( ) , new_feerate) ;
3511+ log_bytes!( chan_id[ ..] ) , chan. get_feerate_sat_per_1000_weight ( ) , new_feerate) ;
35063512 return NotifyOption :: SkipPersist ;
35073513 }
35083514 if !chan. is_live ( ) {
35093515 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)." ,
3510- log_bytes!( chan_id[ ..] ) , chan. get_feerate ( ) , new_feerate) ;
3516+ log_bytes!( chan_id[ ..] ) , chan. get_feerate_sat_per_1000_weight ( ) , new_feerate) ;
35113517 return NotifyOption :: SkipPersist ;
35123518 }
35133519 log_trace ! ( self . logger, "Channel {} qualifies for a feerate change from {} to {}." ,
3514- log_bytes!( chan_id[ ..] ) , chan. get_feerate ( ) , new_feerate) ;
3520+ log_bytes!( chan_id[ ..] ) , chan. get_feerate_sat_per_1000_weight ( ) , new_feerate) ;
35153521
35163522 chan. queue_update_fee ( new_feerate, & self . logger ) ;
35173523 NotifyOption :: DoPersist
@@ -6570,6 +6576,7 @@ impl Writeable for ChannelDetails {
65706576 ( 33 , self . inbound_htlc_minimum_msat, option) ,
65716577 ( 35 , self . inbound_htlc_maximum_msat, option) ,
65726578 ( 37 , user_channel_id_high_opt, option) ,
6579+ ( 39 , self . feerate_sat_per_1000_weight, option) ,
65736580 } ) ;
65746581 Ok ( ( ) )
65756582 }
@@ -6605,6 +6612,7 @@ impl Readable for ChannelDetails {
66056612 ( 33 , inbound_htlc_minimum_msat, option) ,
66066613 ( 35 , inbound_htlc_maximum_msat, option) ,
66076614 ( 37 , user_channel_id_high_opt, option) ,
6615+ ( 39 , feerate_sat_per_1000_weight, option) ,
66086616 } ) ;
66096617
66106618 // `user_channel_id` used to be a single u64 value. In order to remain backwards compatible with
@@ -6638,6 +6646,7 @@ impl Readable for ChannelDetails {
66386646 is_public : is_public. 0 . unwrap ( ) ,
66396647 inbound_htlc_minimum_msat,
66406648 inbound_htlc_maximum_msat,
6649+ feerate_sat_per_1000_weight,
66416650 } )
66426651 }
66436652}
0 commit comments