@@ -1357,6 +1357,12 @@ pub struct ChannelCounterparty {
1357
1357
}
1358
1358
1359
1359
/// 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
1360
1366
#[derive(Clone, Debug, PartialEq)]
1361
1367
pub struct ChannelDetails {
1362
1368
/// The channel's ID (prior to funding transaction generation, this is a random 32 bytes,
@@ -1432,24 +1438,11 @@ pub struct ChannelDetails {
1432
1438
///
1433
1439
/// This value will be `None` for objects serialized with LDK versions prior to 0.0.115.
1434
1440
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,
1446
1441
/// The available outbound capacity for sending HTLCs to the remote peer. This does not include
1447
1442
/// any pending HTLCs which are not yet fully resolved (and, thus, whose balance is not
1448
1443
/// available for inclusion in new outbound HTLCs). This further does not include any pending
1449
1444
/// outgoing HTLCs which are awaiting some other resolution to be sent.
1450
1445
///
1451
- /// See also [`ChannelDetails::balance_msat`]
1452
- ///
1453
1446
/// This value is not exact. Due to various in-flight changes, feerate changes, and our
1454
1447
/// conflict-avoidance policy, exactly this amount is not likely to be spendable. However, we
1455
1448
/// should be able to spend nearly this amount.
@@ -1459,8 +1452,8 @@ pub struct ChannelDetails {
1459
1452
/// the current state and per-HTLC limit(s). This is intended for use when routing, allowing us
1460
1453
/// to use a limit as close as possible to the HTLC limit we can currently send.
1461
1454
///
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`].
1464
1457
pub next_outbound_htlc_limit_msat: u64,
1465
1458
/// The minimum value for sending a single HTLC to the remote peer. This is the equivalent of
1466
1459
/// [`ChannelDetails::next_outbound_htlc_limit_msat`] but represents a lower-bound, rather than
@@ -1588,7 +1581,6 @@ impl ChannelDetails {
1588
1581
channel_value_satoshis: context.get_value_satoshis(),
1589
1582
feerate_sat_per_1000_weight: Some(context.get_feerate_sat_per_1000_weight()),
1590
1583
unspendable_punishment_reserve: to_self_reserve_satoshis,
1591
- balance_msat: balance.balance_msat,
1592
1584
inbound_capacity_msat: balance.inbound_capacity_msat,
1593
1585
outbound_capacity_msat: balance.outbound_capacity_msat,
1594
1586
next_outbound_htlc_limit_msat: balance.next_outbound_htlc_limit_msat,
@@ -7621,7 +7613,7 @@ impl Writeable for ChannelDetails {
7621
7613
(10, self.channel_value_satoshis, required),
7622
7614
(12, self.unspendable_punishment_reserve, option),
7623
7615
(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.
7625
7617
(18, self.outbound_capacity_msat, required),
7626
7618
(19, self.next_outbound_htlc_limit_msat, required),
7627
7619
(20, self.inbound_capacity_msat, required),
@@ -7657,7 +7649,7 @@ impl Readable for ChannelDetails {
7657
7649
(10, channel_value_satoshis, required),
7658
7650
(12, unspendable_punishment_reserve, option),
7659
7651
(14, user_channel_id_low, required),
7660
- (16, balance_msat, required),
7652
+ (16, _balance_msat, option), // Backwards compatibility for removed balance_msat field.
7661
7653
(18, outbound_capacity_msat, required),
7662
7654
// Note that by the time we get past the required read above, outbound_capacity_msat will be
7663
7655
// filled in, so we can safely unwrap it here.
@@ -7683,6 +7675,8 @@ impl Readable for ChannelDetails {
7683
7675
let user_channel_id = user_channel_id_low as u128 +
7684
7676
((user_channel_id_high_opt.unwrap_or(0 as u64) as u128) << 64);
7685
7677
7678
+ let _balance_msat: Option<u64> = _balance_msat;
7679
+
7686
7680
Ok(Self {
7687
7681
inbound_scid_alias,
7688
7682
channel_id: channel_id.0.unwrap(),
@@ -7695,7 +7689,6 @@ impl Readable for ChannelDetails {
7695
7689
channel_value_satoshis: channel_value_satoshis.0.unwrap(),
7696
7690
unspendable_punishment_reserve,
7697
7691
user_channel_id,
7698
- balance_msat: balance_msat.0.unwrap(),
7699
7692
outbound_capacity_msat: outbound_capacity_msat.0.unwrap(),
7700
7693
next_outbound_htlc_limit_msat: next_outbound_htlc_limit_msat.0.unwrap(),
7701
7694
next_outbound_htlc_minimum_msat: next_outbound_htlc_minimum_msat.0.unwrap(),
0 commit comments