@@ -273,8 +273,14 @@ impl_writeable_tlv_based!(ChannelCounterparty, {
273273
274274/// Details of a channel, as returned by [`ChannelManager::list_channels`] and [`ChannelManager::list_usable_channels`]
275275///
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+ ///
276280/// [`ChannelManager::list_channels`]: crate::ln::channelmanager::ChannelManager::list_channels
277281/// [`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
278284#[ derive( Clone , Debug , PartialEq ) ]
279285pub struct ChannelDetails {
280286 /// The channel's ID (prior to funding transaction generation, this is a random 32 bytes,
@@ -353,24 +359,11 @@ pub struct ChannelDetails {
353359 ///
354360 /// This value will be `None` for objects serialized with LDK versions prior to 0.0.115.
355361 pub feerate_sat_per_1000_weight : Option < u32 > ,
356- /// Our total balance. This is the amount we would get if we close the channel.
357- /// This value is not exact. Due to various in-flight changes and feerate changes, exactly this
358- /// amount is not likely to be recoverable on close.
359- ///
360- /// This does not include any pending HTLCs which are not yet fully resolved (and, thus, whose
361- /// balance is not available for inclusion in new outbound HTLCs). This further does not include
362- /// any pending outgoing HTLCs which are awaiting some other resolution to be sent.
363- /// This does not consider any on-chain fees.
364- ///
365- /// See also [`ChannelDetails::outbound_capacity_msat`]
366- pub balance_msat : u64 ,
367362 /// The available outbound capacity for sending HTLCs to the remote peer. This does not include
368363 /// any pending HTLCs which are not yet fully resolved (and, thus, whose balance is not
369364 /// available for inclusion in new outbound HTLCs). This further does not include any pending
370365 /// outgoing HTLCs which are awaiting some other resolution to be sent.
371366 ///
372- /// See also [`ChannelDetails::balance_msat`]
373- ///
374367 /// This value is not exact. Due to various in-flight changes, feerate changes, and our
375368 /// conflict-avoidance policy, exactly this amount is not likely to be spendable. However, we
376369 /// should be able to spend nearly this amount.
@@ -380,8 +373,8 @@ pub struct ChannelDetails {
380373 /// the current state and per-HTLC limit(s). This is intended for use when routing, allowing us
381374 /// to use a limit as close as possible to the HTLC limit we can currently send.
382375 ///
383- /// See also [`ChannelDetails::next_outbound_htlc_minimum_msat`],
384- /// [`ChannelDetails::balance_msat`], and [`ChannelDetails:: outbound_capacity_msat`].
376+ /// See also [`ChannelDetails::next_outbound_htlc_minimum_msat`] and
377+ /// [`ChannelDetails::outbound_capacity_msat`].
385378 pub next_outbound_htlc_limit_msat : u64 ,
386379 /// The minimum value for sending a single HTLC to the remote peer. This is the equivalent of
387380 /// [`ChannelDetails::next_outbound_htlc_limit_msat`] but represents a lower-bound, rather than
@@ -532,7 +525,6 @@ impl ChannelDetails {
532525 channel_value_satoshis : context. get_value_satoshis ( ) ,
533526 feerate_sat_per_1000_weight : Some ( context. get_feerate_sat_per_1000_weight ( ) ) ,
534527 unspendable_punishment_reserve : to_self_reserve_satoshis,
535- balance_msat : balance. balance_msat ,
536528 inbound_capacity_msat : balance. inbound_capacity_msat ,
537529 outbound_capacity_msat : balance. outbound_capacity_msat ,
538530 next_outbound_htlc_limit_msat : balance. next_outbound_htlc_limit_msat ,
@@ -574,7 +566,7 @@ impl Writeable for ChannelDetails {
574566 ( 10 , self . channel_value_satoshis, required) ,
575567 ( 12 , self . unspendable_punishment_reserve, option) ,
576568 ( 14 , user_channel_id_low, required) ,
577- ( 16 , self . balance_msat , required) ,
569+ ( 16 , self . next_outbound_htlc_limit_msat , required) , // Forwards compatibility for removed balance_msat field.
578570 ( 18 , self . outbound_capacity_msat, required) ,
579571 ( 19 , self . next_outbound_htlc_limit_msat, required) ,
580572 ( 20 , self . inbound_capacity_msat, required) ,
@@ -612,7 +604,7 @@ impl Readable for ChannelDetails {
612604 ( 10 , channel_value_satoshis, required) ,
613605 ( 12 , unspendable_punishment_reserve, option) ,
614606 ( 14 , user_channel_id_low, required) ,
615- ( 16 , balance_msat , required ) ,
607+ ( 16 , _balance_msat , option ) , // Backwards compatibility for removed balance_msat field.
616608 ( 18 , outbound_capacity_msat, required) ,
617609 // Note that by the time we get past the required read above, outbound_capacity_msat will be
618610 // filled in, so we can safely unwrap it here.
@@ -640,6 +632,8 @@ impl Readable for ChannelDetails {
640632 let user_channel_id = user_channel_id_low as u128
641633 + ( ( user_channel_id_high_opt. unwrap_or ( 0 as u64 ) as u128 ) << 64 ) ;
642634
635+ let _balance_msat: Option < u64 > = _balance_msat;
636+
643637 Ok ( Self {
644638 inbound_scid_alias,
645639 channel_id : channel_id. 0 . unwrap ( ) ,
@@ -652,7 +646,6 @@ impl Readable for ChannelDetails {
652646 channel_value_satoshis : channel_value_satoshis. 0 . unwrap ( ) ,
653647 unspendable_punishment_reserve,
654648 user_channel_id,
655- balance_msat : balance_msat. 0 . unwrap ( ) ,
656649 outbound_capacity_msat : outbound_capacity_msat. 0 . unwrap ( ) ,
657650 next_outbound_htlc_limit_msat : next_outbound_htlc_limit_msat. 0 . unwrap ( ) ,
658651 next_outbound_htlc_minimum_msat : next_outbound_htlc_minimum_msat. 0 . unwrap ( ) ,
0 commit comments