@@ -273,8 +273,14 @@ impl_writeable_tlv_based!(ChannelCounterparty, {
273
273
274
274
/// Details of a channel, as returned by [`ChannelManager::list_channels`] and [`ChannelManager::list_usable_channels`]
275
275
///
276
+ /// Balances of a channel are available through [`ChainMonitor::get_claimable_balances`] and
277
+ /// [`ChannelMonitor::get_claimable_balances`], calculated with respect to the corresponding on-chain
278
+ /// transactions.
279
+ ///
276
280
/// [`ChannelManager::list_channels`]: crate::ln::channelmanager::ChannelManager::list_channels
277
281
/// [`ChannelManager::list_usable_channels`]: crate::ln::channelmanager::ChannelManager::list_usable_channels
282
+ /// [`ChainMonitor::get_claimable_balances`]: crate::chain::chainmonitor::ChainMonitor::get_claimable_balances
283
+ /// [`ChannelMonitor::get_claimable_balances`]: crate::chain::channelmonitor::ChannelMonitor::get_claimable_balances
278
284
#[ derive( Clone , Debug , PartialEq ) ]
279
285
pub struct ChannelDetails {
280
286
/// The channel's ID (prior to funding transaction generation, this is a random 32 bytes,
@@ -363,6 +369,10 @@ pub struct ChannelDetails {
363
369
/// This does not consider any on-chain fees.
364
370
///
365
371
/// See also [`ChannelDetails::outbound_capacity_msat`]
372
+ #[ deprecated(
373
+ since = "0.0.124" ,
374
+ note = "use [`ChannelMonitor::get_claimable_balances`] instead"
375
+ ) ]
366
376
pub balance_msat : u64 ,
367
377
/// The available outbound capacity for sending HTLCs to the remote peer. This does not include
368
378
/// any pending HTLCs which are not yet fully resolved (and, thus, whose balance is not
@@ -495,6 +505,7 @@ impl ChannelDetails {
495
505
let balance = context. get_available_balances ( fee_estimator) ;
496
506
let ( to_remote_reserve_satoshis, to_self_reserve_satoshis) =
497
507
context. get_holder_counterparty_selected_channel_reserve_satoshis ( ) ;
508
+ #[ allow( deprecated) ] // TODO: Remove once balance_msat is removed.
498
509
ChannelDetails {
499
510
channel_id : context. channel_id ( ) ,
500
511
counterparty : ChannelCounterparty {
@@ -561,38 +572,41 @@ impl Writeable for ChannelDetails {
561
572
// versions prior to 0.0.113, the u128 is serialized as two separate u64 values.
562
573
let user_channel_id_low = self . user_channel_id as u64 ;
563
574
let user_channel_id_high_opt = Some ( ( self . user_channel_id >> 64 ) as u64 ) ;
564
- write_tlv_fields ! ( writer, {
565
- ( 1 , self . inbound_scid_alias, option) ,
566
- ( 2 , self . channel_id, required) ,
567
- ( 3 , self . channel_type, option) ,
568
- ( 4 , self . counterparty, required) ,
569
- ( 5 , self . outbound_scid_alias, option) ,
570
- ( 6 , self . funding_txo, option) ,
571
- ( 7 , self . config, option) ,
572
- ( 8 , self . short_channel_id, option) ,
573
- ( 9 , self . confirmations, option) ,
574
- ( 10 , self . channel_value_satoshis, required) ,
575
- ( 12 , self . unspendable_punishment_reserve, option) ,
576
- ( 14 , user_channel_id_low, required) ,
577
- ( 16 , self . balance_msat, required) ,
578
- ( 18 , self . outbound_capacity_msat, required) ,
579
- ( 19 , self . next_outbound_htlc_limit_msat, required) ,
580
- ( 20 , self . inbound_capacity_msat, required) ,
581
- ( 21 , self . next_outbound_htlc_minimum_msat, required) ,
582
- ( 22 , self . confirmations_required, option) ,
583
- ( 24 , self . force_close_spend_delay, option) ,
584
- ( 26 , self . is_outbound, required) ,
585
- ( 28 , self . is_channel_ready, required) ,
586
- ( 30 , self . is_usable, required) ,
587
- ( 32 , self . is_public, required) ,
588
- ( 33 , self . inbound_htlc_minimum_msat, option) ,
589
- ( 35 , self . inbound_htlc_maximum_msat, option) ,
590
- ( 37 , user_channel_id_high_opt, option) ,
591
- ( 39 , self . feerate_sat_per_1000_weight, option) ,
592
- ( 41 , self . channel_shutdown_state, option) ,
593
- ( 43 , self . pending_inbound_htlcs, optional_vec) ,
594
- ( 45 , self . pending_outbound_htlcs, optional_vec) ,
595
- } ) ;
575
+ #[ allow( deprecated) ] // TODO: Remove once balance_msat is removed.
576
+ {
577
+ write_tlv_fields ! ( writer, {
578
+ ( 1 , self . inbound_scid_alias, option) ,
579
+ ( 2 , self . channel_id, required) ,
580
+ ( 3 , self . channel_type, option) ,
581
+ ( 4 , self . counterparty, required) ,
582
+ ( 5 , self . outbound_scid_alias, option) ,
583
+ ( 6 , self . funding_txo, option) ,
584
+ ( 7 , self . config, option) ,
585
+ ( 8 , self . short_channel_id, option) ,
586
+ ( 9 , self . confirmations, option) ,
587
+ ( 10 , self . channel_value_satoshis, required) ,
588
+ ( 12 , self . unspendable_punishment_reserve, option) ,
589
+ ( 14 , user_channel_id_low, required) ,
590
+ ( 16 , self . balance_msat, required) ,
591
+ ( 18 , self . outbound_capacity_msat, required) ,
592
+ ( 19 , self . next_outbound_htlc_limit_msat, required) ,
593
+ ( 20 , self . inbound_capacity_msat, required) ,
594
+ ( 21 , self . next_outbound_htlc_minimum_msat, required) ,
595
+ ( 22 , self . confirmations_required, option) ,
596
+ ( 24 , self . force_close_spend_delay, option) ,
597
+ ( 26 , self . is_outbound, required) ,
598
+ ( 28 , self . is_channel_ready, required) ,
599
+ ( 30 , self . is_usable, required) ,
600
+ ( 32 , self . is_public, required) ,
601
+ ( 33 , self . inbound_htlc_minimum_msat, option) ,
602
+ ( 35 , self . inbound_htlc_maximum_msat, option) ,
603
+ ( 37 , user_channel_id_high_opt, option) ,
604
+ ( 39 , self . feerate_sat_per_1000_weight, option) ,
605
+ ( 41 , self . channel_shutdown_state, option) ,
606
+ ( 43 , self . pending_inbound_htlcs, optional_vec) ,
607
+ ( 45 , self . pending_outbound_htlcs, optional_vec) ,
608
+ } ) ;
609
+ }
596
610
Ok ( ( ) )
597
611
}
598
612
}
@@ -640,6 +654,7 @@ impl Readable for ChannelDetails {
640
654
let user_channel_id = user_channel_id_low as u128
641
655
+ ( ( user_channel_id_high_opt. unwrap_or ( 0 as u64 ) as u128 ) << 64 ) ;
642
656
657
+ #[ allow( deprecated) ] // TODO: Remove once balance_msat is removed.
643
658
Ok ( Self {
644
659
inbound_scid_alias,
645
660
channel_id : channel_id. 0 . unwrap ( ) ,
0 commit comments