@@ -1357,6 +1357,12 @@ pub struct ChannelCounterparty {
13571357}
13581358
13591359/// Details of a channel, as returned by [`ChannelManager::list_channels`] and [`ChannelManager::list_usable_channels`]
1360+ ///
1361+ /// Balances of a channel are available through [`ChainMonitor::get_claimable_balances`] and
1362+ /// [`ChannelMonitor::get_claimable_balances`], calculated with respect to the corresponding on-chain
1363+ /// transactions.
1364+ ///
1365+ /// [`ChainMonitor::get_claimable_balances`]: crate::chain::chainmonitor::ChainMonitor::get_claimable_balances
13601366#[derive(Clone, Debug, PartialEq)]
13611367pub struct ChannelDetails {
13621368 /// The channel's ID (prior to funding transaction generation, this is a random 32 bytes,
@@ -1432,24 +1438,11 @@ pub struct ChannelDetails {
14321438 ///
14331439 /// This value will be `None` for objects serialized with LDK versions prior to 0.0.115.
14341440 pub feerate_sat_per_1000_weight: Option<u32>,
1435- /// Our total balance. This is the amount we would get if we close the channel.
1436- /// This value is not exact. Due to various in-flight changes and feerate changes, exactly this
1437- /// amount is not likely to be recoverable on close.
1438- ///
1439- /// This does not include any pending HTLCs which are not yet fully resolved (and, thus, whose
1440- /// balance is not available for inclusion in new outbound HTLCs). This further does not include
1441- /// any pending outgoing HTLCs which are awaiting some other resolution to be sent.
1442- /// This does not consider any on-chain fees.
1443- ///
1444- /// See also [`ChannelDetails::outbound_capacity_msat`]
1445- pub balance_msat: u64,
14461441 /// The available outbound capacity for sending HTLCs to the remote peer. This does not include
14471442 /// any pending HTLCs which are not yet fully resolved (and, thus, whose balance is not
14481443 /// available for inclusion in new outbound HTLCs). This further does not include any pending
14491444 /// outgoing HTLCs which are awaiting some other resolution to be sent.
14501445 ///
1451- /// See also [`ChannelDetails::balance_msat`]
1452- ///
14531446 /// This value is not exact. Due to various in-flight changes, feerate changes, and our
14541447 /// conflict-avoidance policy, exactly this amount is not likely to be spendable. However, we
14551448 /// should be able to spend nearly this amount.
@@ -1459,8 +1452,8 @@ pub struct ChannelDetails {
14591452 /// the current state and per-HTLC limit(s). This is intended for use when routing, allowing us
14601453 /// to use a limit as close as possible to the HTLC limit we can currently send.
14611454 ///
1462- /// See also [`ChannelDetails::next_outbound_htlc_minimum_msat`],
1463- /// [`ChannelDetails::balance_msat`], and [`ChannelDetails:: outbound_capacity_msat`].
1455+ /// See also [`ChannelDetails::next_outbound_htlc_minimum_msat`] and
1456+ /// [`ChannelDetails::outbound_capacity_msat`].
14641457 pub next_outbound_htlc_limit_msat: u64,
14651458 /// The minimum value for sending a single HTLC to the remote peer. This is the equivalent of
14661459 /// [`ChannelDetails::next_outbound_htlc_limit_msat`] but represents a lower-bound, rather than
@@ -1588,7 +1581,6 @@ impl ChannelDetails {
15881581 channel_value_satoshis: context.get_value_satoshis(),
15891582 feerate_sat_per_1000_weight: Some(context.get_feerate_sat_per_1000_weight()),
15901583 unspendable_punishment_reserve: to_self_reserve_satoshis,
1591- balance_msat: balance.balance_msat,
15921584 inbound_capacity_msat: balance.inbound_capacity_msat,
15931585 outbound_capacity_msat: balance.outbound_capacity_msat,
15941586 next_outbound_htlc_limit_msat: balance.next_outbound_htlc_limit_msat,
@@ -7621,7 +7613,7 @@ impl Writeable for ChannelDetails {
76217613 (10, self.channel_value_satoshis, required),
76227614 (12, self.unspendable_punishment_reserve, option),
76237615 (14, user_channel_id_low, required),
7624- (16, self.balance_msat , required),
7616+ (16, self.next_outbound_htlc_limit_msat , required), // Forwards compatibility for removed balance_msat field.
76257617 (18, self.outbound_capacity_msat, required),
76267618 (19, self.next_outbound_htlc_limit_msat, required),
76277619 (20, self.inbound_capacity_msat, required),
@@ -7657,7 +7649,7 @@ impl Readable for ChannelDetails {
76577649 (10, channel_value_satoshis, required),
76587650 (12, unspendable_punishment_reserve, option),
76597651 (14, user_channel_id_low, required),
7660- (16, balance_msat, required),
7652+ (16, _balance_msat, option), // Backwards compatibility for removed balance_msat field.
76617653 (18, outbound_capacity_msat, required),
76627654 // Note that by the time we get past the required read above, outbound_capacity_msat will be
76637655 // filled in, so we can safely unwrap it here.
@@ -7683,6 +7675,8 @@ impl Readable for ChannelDetails {
76837675 let user_channel_id = user_channel_id_low as u128 +
76847676 ((user_channel_id_high_opt.unwrap_or(0 as u64) as u128) << 64);
76857677
7678+ let _balance_msat: Option<u64> = _balance_msat;
7679+
76867680 Ok(Self {
76877681 inbound_scid_alias,
76887682 channel_id: channel_id.0.unwrap(),
@@ -7695,7 +7689,6 @@ impl Readable for ChannelDetails {
76957689 channel_value_satoshis: channel_value_satoshis.0.unwrap(),
76967690 unspendable_punishment_reserve,
76977691 user_channel_id,
7698- balance_msat: balance_msat.0.unwrap(),
76997692 outbound_capacity_msat: outbound_capacity_msat.0.unwrap(),
77007693 next_outbound_htlc_limit_msat: next_outbound_htlc_limit_msat.0.unwrap(),
77017694 next_outbound_htlc_minimum_msat: next_outbound_htlc_minimum_msat.0.unwrap(),
0 commit comments