/// Details of a channel, as returned by [`ChannelManager::list_channels`] and [`ChannelManager::list_usable_channels`]
///
+/// Balances of a channel are available through [`ChainMonitor::get_claimable_balances`] and
+/// [`ChannelMonitor::get_claimable_balances`], calculated with respect to the corresponding on-chain
+/// transactions.
+///
/// [`ChannelManager::list_channels`]: crate::ln::channelmanager::ChannelManager::list_channels
/// [`ChannelManager::list_usable_channels`]: crate::ln::channelmanager::ChannelManager::list_usable_channels
+/// [`ChainMonitor::get_claimable_balances`]: crate::chain::chainmonitor::ChainMonitor::get_claimable_balances
+/// [`ChannelMonitor::get_claimable_balances`]: crate::chain::channelmonitor::ChannelMonitor::get_claimable_balances
#[derive(Clone, Debug, PartialEq)]
pub struct ChannelDetails {
/// The channel's ID (prior to funding transaction generation, this is a random 32 bytes,
/// This does not consider any on-chain fees.
///
/// See also [`ChannelDetails::outbound_capacity_msat`]
+ #[deprecated(since = "0.0.124", note = "use [`ChainMonitor::get_claimable_balances`] instead")]
pub balance_msat: u64,
/// The available outbound capacity for sending HTLCs to the remote peer. This does not include
/// any pending HTLCs which are not yet fully resolved (and, thus, whose balance is not
let balance = context.get_available_balances(fee_estimator);
let (to_remote_reserve_satoshis, to_self_reserve_satoshis) =
context.get_holder_counterparty_selected_channel_reserve_satoshis();
+ #[allow(deprecated)] // TODO: Remove once balance_msat is removed.
ChannelDetails {
channel_id: context.channel_id(),
counterparty: ChannelCounterparty {
// versions prior to 0.0.113, the u128 is serialized as two separate u64 values.
let user_channel_id_low = self.user_channel_id as u64;
let user_channel_id_high_opt = Some((self.user_channel_id >> 64) as u64);
- write_tlv_fields!(writer, {
- (1, self.inbound_scid_alias, option),
- (2, self.channel_id, required),
- (3, self.channel_type, option),
- (4, self.counterparty, required),
- (5, self.outbound_scid_alias, option),
- (6, self.funding_txo, option),
- (7, self.config, option),
- (8, self.short_channel_id, option),
- (9, self.confirmations, option),
- (10, self.channel_value_satoshis, required),
- (12, self.unspendable_punishment_reserve, option),
- (14, user_channel_id_low, required),
- (16, self.balance_msat, required),
- (18, self.outbound_capacity_msat, required),
- (19, self.next_outbound_htlc_limit_msat, required),
- (20, self.inbound_capacity_msat, required),
- (21, self.next_outbound_htlc_minimum_msat, required),
- (22, self.confirmations_required, option),
- (24, self.force_close_spend_delay, option),
- (26, self.is_outbound, required),
- (28, self.is_channel_ready, required),
- (30, self.is_usable, required),
- (32, self.is_public, required),
- (33, self.inbound_htlc_minimum_msat, option),
- (35, self.inbound_htlc_maximum_msat, option),
- (37, user_channel_id_high_opt, option),
- (39, self.feerate_sat_per_1000_weight, option),
- (41, self.channel_shutdown_state, option),
- (43, self.pending_inbound_htlcs, optional_vec),
- (45, self.pending_outbound_htlcs, optional_vec),
- });
+ #[allow(deprecated)] // TODO: Remove once balance_msat is removed.
+ {
+ write_tlv_fields!(writer, {
+ (1, self.inbound_scid_alias, option),
+ (2, self.channel_id, required),
+ (3, self.channel_type, option),
+ (4, self.counterparty, required),
+ (5, self.outbound_scid_alias, option),
+ (6, self.funding_txo, option),
+ (7, self.config, option),
+ (8, self.short_channel_id, option),
+ (9, self.confirmations, option),
+ (10, self.channel_value_satoshis, required),
+ (12, self.unspendable_punishment_reserve, option),
+ (14, user_channel_id_low, required),
+ (16, self.balance_msat, required),
+ (18, self.outbound_capacity_msat, required),
+ (19, self.next_outbound_htlc_limit_msat, required),
+ (20, self.inbound_capacity_msat, required),
+ (21, self.next_outbound_htlc_minimum_msat, required),
+ (22, self.confirmations_required, option),
+ (24, self.force_close_spend_delay, option),
+ (26, self.is_outbound, required),
+ (28, self.is_channel_ready, required),
+ (30, self.is_usable, required),
+ (32, self.is_public, required),
+ (33, self.inbound_htlc_minimum_msat, option),
+ (35, self.inbound_htlc_maximum_msat, option),
+ (37, user_channel_id_high_opt, option),
+ (39, self.feerate_sat_per_1000_weight, option),
+ (41, self.channel_shutdown_state, option),
+ (43, self.pending_inbound_htlcs, optional_vec),
+ (45, self.pending_outbound_htlcs, optional_vec),
+ });
+ }
Ok(())
}
}
let user_channel_id = user_channel_id_low as u128
+ ((user_channel_id_high_opt.unwrap_or(0 as u64) as u128) << 64);
+ #[allow(deprecated)] // TODO: Remove once balance_msat is removed.
Ok(Self {
inbound_scid_alias,
channel_id: channel_id.0.unwrap(),