@@ -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,
@@ -353,24 +359,11 @@ pub struct ChannelDetails {
353
359
///
354
360
/// This value will be `None` for objects serialized with LDK versions prior to 0.0.115.
355
361
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 ,
367
362
/// The available outbound capacity for sending HTLCs to the remote peer. This does not include
368
363
/// any pending HTLCs which are not yet fully resolved (and, thus, whose balance is not
369
364
/// available for inclusion in new outbound HTLCs). This further does not include any pending
370
365
/// outgoing HTLCs which are awaiting some other resolution to be sent.
371
366
///
372
- /// See also [`ChannelDetails::balance_msat`]
373
- ///
374
367
/// This value is not exact. Due to various in-flight changes, feerate changes, and our
375
368
/// conflict-avoidance policy, exactly this amount is not likely to be spendable. However, we
376
369
/// should be able to spend nearly this amount.
@@ -380,8 +373,8 @@ pub struct ChannelDetails {
380
373
/// the current state and per-HTLC limit(s). This is intended for use when routing, allowing us
381
374
/// to use a limit as close as possible to the HTLC limit we can currently send.
382
375
///
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`].
385
378
pub next_outbound_htlc_limit_msat : u64 ,
386
379
/// The minimum value for sending a single HTLC to the remote peer. This is the equivalent of
387
380
/// [`ChannelDetails::next_outbound_htlc_limit_msat`] but represents a lower-bound, rather than
@@ -532,7 +525,6 @@ impl ChannelDetails {
532
525
channel_value_satoshis : context. get_value_satoshis ( ) ,
533
526
feerate_sat_per_1000_weight : Some ( context. get_feerate_sat_per_1000_weight ( ) ) ,
534
527
unspendable_punishment_reserve : to_self_reserve_satoshis,
535
- balance_msat : balance. balance_msat ,
536
528
inbound_capacity_msat : balance. inbound_capacity_msat ,
537
529
outbound_capacity_msat : balance. outbound_capacity_msat ,
538
530
next_outbound_htlc_limit_msat : balance. next_outbound_htlc_limit_msat ,
@@ -574,7 +566,7 @@ impl Writeable for ChannelDetails {
574
566
( 10 , self . channel_value_satoshis, required) ,
575
567
( 12 , self . unspendable_punishment_reserve, option) ,
576
568
( 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.
578
570
( 18 , self . outbound_capacity_msat, required) ,
579
571
( 19 , self . next_outbound_htlc_limit_msat, required) ,
580
572
( 20 , self . inbound_capacity_msat, required) ,
@@ -612,7 +604,7 @@ impl Readable for ChannelDetails {
612
604
( 10 , channel_value_satoshis, required) ,
613
605
( 12 , unspendable_punishment_reserve, option) ,
614
606
( 14 , user_channel_id_low, required) ,
615
- ( 16 , balance_msat , required ) ,
607
+ ( 16 , _balance_msat , option ) , // Backwards compatibility for removed balance_msat field.
616
608
( 18 , outbound_capacity_msat, required) ,
617
609
// Note that by the time we get past the required read above, outbound_capacity_msat will be
618
610
// filled in, so we can safely unwrap it here.
@@ -640,6 +632,8 @@ impl Readable for ChannelDetails {
640
632
let user_channel_id = user_channel_id_low as u128
641
633
+ ( ( user_channel_id_high_opt. unwrap_or ( 0 as u64 ) as u128 ) << 64 ) ;
642
634
635
+ let _balance_msat: Option < u64 > = _balance_msat;
636
+
643
637
Ok ( Self {
644
638
inbound_scid_alias,
645
639
channel_id : channel_id. 0 . unwrap ( ) ,
@@ -652,7 +646,6 @@ impl Readable for ChannelDetails {
652
646
channel_value_satoshis : channel_value_satoshis. 0 . unwrap ( ) ,
653
647
unspendable_punishment_reserve,
654
648
user_channel_id,
655
- balance_msat : balance_msat. 0 . unwrap ( ) ,
656
649
outbound_capacity_msat : outbound_capacity_msat. 0 . unwrap ( ) ,
657
650
next_outbound_htlc_limit_msat : next_outbound_htlc_limit_msat. 0 . unwrap ( ) ,
658
651
next_outbound_htlc_minimum_msat : next_outbound_htlc_minimum_msat. 0 . unwrap ( ) ,
0 commit comments