@@ -1118,6 +1118,11 @@ pub struct ChannelDetails {
1118
1118
/// inbound. This may be zero for inbound channels serialized with LDK versions prior to
1119
1119
/// 0.0.113.
1120
1120
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 > ,
1121
1126
/// Our total balance. This is the amount we would get if we close the channel.
1122
1127
/// This value is not exact. Due to various in-flight changes and feerate changes, exactly this
1123
1128
/// amount is not likely to be recoverable on close.
@@ -1260,6 +1265,7 @@ impl ChannelDetails {
1260
1265
outbound_scid_alias : if channel. is_usable ( ) { Some ( channel. outbound_scid_alias ( ) ) } else { None } ,
1261
1266
inbound_scid_alias : channel. latest_inbound_scid_alias ( ) ,
1262
1267
channel_value_satoshis : channel. get_value_satoshis ( ) ,
1268
+ feerate_sat_per_1000_weight : Some ( channel. get_feerate_sat_per_1000_weight ( ) ) ,
1263
1269
unspendable_punishment_reserve : to_self_reserve_satoshis,
1264
1270
balance_msat : balance. balance_msat ,
1265
1271
inbound_capacity_msat : balance. inbound_capacity_msat ,
@@ -3500,18 +3506,18 @@ where
3500
3506
fn update_channel_fee ( & self , chan_id : & [ u8 ; 32 ] , chan : & mut Channel < <SP :: Target as SignerProvider >:: Signer > , new_feerate : u32 ) -> NotifyOption {
3501
3507
if !chan. is_outbound ( ) { return NotifyOption :: SkipPersist ; }
3502
3508
// 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 ( ) {
3504
3510
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) ;
3506
3512
return NotifyOption :: SkipPersist ;
3507
3513
}
3508
3514
if !chan. is_live ( ) {
3509
3515
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) ;
3511
3517
return NotifyOption :: SkipPersist ;
3512
3518
}
3513
3519
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) ;
3515
3521
3516
3522
chan. queue_update_fee ( new_feerate, & self . logger ) ;
3517
3523
NotifyOption :: DoPersist
@@ -6570,6 +6576,7 @@ impl Writeable for ChannelDetails {
6570
6576
( 33 , self . inbound_htlc_minimum_msat, option) ,
6571
6577
( 35 , self . inbound_htlc_maximum_msat, option) ,
6572
6578
( 37 , user_channel_id_high_opt, option) ,
6579
+ ( 39 , self . feerate_sat_per_1000_weight, option) ,
6573
6580
} ) ;
6574
6581
Ok ( ( ) )
6575
6582
}
@@ -6605,6 +6612,7 @@ impl Readable for ChannelDetails {
6605
6612
( 33 , inbound_htlc_minimum_msat, option) ,
6606
6613
( 35 , inbound_htlc_maximum_msat, option) ,
6607
6614
( 37 , user_channel_id_high_opt, option) ,
6615
+ ( 39 , feerate_sat_per_1000_weight, option) ,
6608
6616
} ) ;
6609
6617
6610
6618
// `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 {
6638
6646
is_public : is_public. 0 . unwrap ( ) ,
6639
6647
inbound_htlc_minimum_msat,
6640
6648
inbound_htlc_maximum_msat,
6649
+ feerate_sat_per_1000_weight,
6641
6650
} )
6642
6651
}
6643
6652
}
0 commit comments