@@ -656,25 +656,74 @@ pub struct ChannelDetails {
656656 pub counterparty_features : InitFeatures ,
657657 /// The value, in satoshis, of this channel as appears in the funding output
658658 pub channel_value_satoshis : u64 ,
659+ /// The value, in satoshis, which must always be held in the channel for us. This value ensures
660+ /// that if we broadcast a revoked state, our counterparty can punish us by claiming at least
661+ /// this value on chain.
662+ ///
663+ /// This value is not included in [`outbound_capacity_msat`] as it can never be spent.
664+ ///
665+ /// This value will be `None` for outbound channels until the counterparty accepts the channel.
666+ ///
667+ /// [`outbound_capacity_msat`]: ChannelDetails::outbound_capacity_msat
668+ pub counterparty_selected_channel_reserve_satoshis : Option < u64 > ,
669+ /// The value, in satoshis, which must always be held in the channel for our counterparty. This
670+ /// value ensures that if our counterparty broadcasts a revoked state, we can punish them by
671+ /// claiming at least this value on chain.
672+ ///
673+ /// This value is not included in [`inbound_capacity_msat`] as it can never be spent.
674+ ///
675+ /// [`inbound_capacity_msat`]: ChannelDetails::inbound_capacity_msat
676+ pub holder_selected_channel_reserve_satoshis : u64 ,
659677 /// The user_id passed in to create_channel, or 0 if the channel was inbound.
660678 pub user_id : u64 ,
661679 /// The available outbound capacity for sending HTLCs to the remote peer. This does not include
662680 /// any pending HTLCs which are not yet fully resolved (and, thus, who's balance is not
663681 /// available for inclusion in new outbound HTLCs). This further does not include any pending
664682 /// outgoing HTLCs which are awaiting some other resolution to be sent.
683+ ///
684+ /// This value is not exact. Due to various in-flight changes, feerate changes, and our
685+ /// conflict-avoidance policy, exactly this amount is not likely to be spendable. However, we
686+ /// should be able to spend nearly this amount.
665687 pub outbound_capacity_msat : u64 ,
666688 /// The available inbound capacity for the remote peer to send HTLCs to us. This does not
667689 /// include any pending HTLCs which are not yet fully resolved (and, thus, who's balance is not
668690 /// available for inclusion in new inbound HTLCs).
669691 /// Note that there are some corner cases not fully handled here, so the actual available
670692 /// inbound capacity may be slightly higher than this.
693+ ///
694+ /// This value is not exact. Due to various in-flight changes, feerate changes, and our
695+ /// counterparty's conflict-avoidance policy, exactly this amount is not likely to be spendable.
696+ /// However, our counterparty should be able to spend nearly this amount.
671697 pub inbound_capacity_msat : u64 ,
698+ /// The number of required confirmations on the funding transaction before the funding will be
699+ /// considered "locked". This number is selected by the channel fundee (ie us if
700+ /// [`is_outbound`] is *not* set), and can be selected for inbound channels with
701+ /// [`ChannelHandshakeConfig::minimum_depth`] or limited for outbound channels with
702+ /// [`ChannelHandshakeLimits::max_minimum_depth`].
703+ ///
704+ /// This value will be `None` for outbound channels until the counterparty accepts the channel.
705+ ///
706+ /// [`is_outbound`]: ChannelDetails::is_outbound
707+ /// [`ChannelHandshakeConfig::minimum_depth`]: crate::util::config::ChannelHandshakeConfig::minimum_depth
708+ /// [`ChannelHandshakeLimits::max_minimum_depth`]: crate::util::config::ChannelHandshakeLimits::max_minimum_depth
709+ pub confirmations_required : Option < u32 > ,
710+ /// The number of blocks (after our commitment transaction confirms) which we will need to wait
711+ /// until we can claim our funds after we force-close the channel. During this time our
712+ /// counterparty is allowed to punish us if we broadcasted a stale state. If our counterparty
713+ /// force-closes the channel and broadcasts a commitment transaction we do not have to wait any
714+ /// time to claim our non-HTLC-encumbered funds.
715+ ///
716+ /// This value will be `None` for outbound channels until the counterparty accepts the channel.
717+ pub to_self_delay : Option < u16 > ,
672718 /// True if the channel was initiated (and thus funded) by us.
673719 pub is_outbound : bool ,
674720 /// True if the channel is confirmed, funding_locked messages have been exchanged, and the
675721 /// channel is not currently being shut down. `funding_locked` message exchange implies the
676722 /// required confirmation count has been reached (and we were connected to the peer at some
677- /// point after the funding transaction received enough confirmations).
723+ /// point after the funding transaction received enough confirmations). The required
724+ /// confirmation count is provided in [`confirmations_required`].
725+ ///
726+ /// [`confirmations_required`]: ChannelDetails::confirmations_required
678727 pub is_funding_locked : bool ,
679728 /// True if the channel is (a) confirmed and funding_locked messages have been exchanged, (b)
680729 /// the peer is connected, and (c) the channel is not currently negotiating a shutdown.
@@ -1146,16 +1195,22 @@ impl<Signer: Sign, M: Deref, T: Deref, K: Deref, F: Deref, L: Deref> ChannelMana
11461195 res. reserve ( channel_state. by_id . len ( ) ) ;
11471196 for ( channel_id, channel) in channel_state. by_id . iter ( ) . filter ( f) {
11481197 let ( inbound_capacity_msat, outbound_capacity_msat) = channel. get_inbound_outbound_available_balance_msat ( ) ;
1198+ let ( holder_selected_channel_reserve_satoshis, counterparty_selected_channel_reserve_satoshis) =
1199+ channel. get_holder_counterparty_selected_channel_reserve_satoshis ( ) ;
11491200 res. push ( ChannelDetails {
11501201 channel_id : ( * channel_id) . clone ( ) ,
11511202 funding_txo : channel. get_funding_txo ( ) ,
11521203 short_channel_id : channel. get_short_channel_id ( ) ,
11531204 remote_network_id : channel. get_counterparty_node_id ( ) ,
11541205 counterparty_features : InitFeatures :: empty ( ) ,
11551206 channel_value_satoshis : channel. get_value_satoshis ( ) ,
1207+ counterparty_selected_channel_reserve_satoshis,
1208+ holder_selected_channel_reserve_satoshis,
11561209 inbound_capacity_msat,
11571210 outbound_capacity_msat,
11581211 user_id : channel. get_user_id ( ) ,
1212+ confirmations_required : channel. minimum_depth ( ) ,
1213+ to_self_delay : channel. get_counterparty_selected_contest_delay ( ) ,
11591214 is_outbound : channel. is_outbound ( ) ,
11601215 is_funding_locked : channel. is_usable ( ) ,
11611216 is_usable : channel. is_live ( ) ,
0 commit comments