@@ -656,25 +656,68 @@ 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+ /// [`outbound_capacity_msat`]: ChannelDetails::outbound_capacity_msat
666+ pub counterparty_selected_channel_reserve_satoshis : u64 ,
667+ /// The value, in satoshis, which must always be held in the channel for our counterparty. This
668+ /// value ensures that if our counterparty broadcasts a revoked state, we can punish them by
669+ /// claiming at least this value on chain.
670+ ///
671+ /// This value is not included in [`inbound_capacity_msat`] as it can never be spent.
672+ ///
673+ /// [`inbound_capacity_msat`]: ChannelDetails::inbound_capacity_msat
674+ pub holder_selected_channel_reserve_satoshis : u64 ,
659675 /// The user_id passed in to create_channel, or 0 if the channel was inbound.
660676 pub user_id : u64 ,
661677 /// The available outbound capacity for sending HTLCs to the remote peer. This does not include
662678 /// any pending HTLCs which are not yet fully resolved (and, thus, who's balance is not
663679 /// available for inclusion in new outbound HTLCs). This further does not include any pending
664680 /// outgoing HTLCs which are awaiting some other resolution to be sent.
681+ ///
682+ /// This value is not exact. Due to various in-flight changes, feerate changes, and our
683+ /// conflict-avoidance policy, exactly this amount is not likely to be spendable. However, we
684+ /// should be able to spend nearly this amount.
665685 pub outbound_capacity_msat : u64 ,
666686 /// The available inbound capacity for the remote peer to send HTLCs to us. This does not
667687 /// include any pending HTLCs which are not yet fully resolved (and, thus, who's balance is not
668688 /// available for inclusion in new inbound HTLCs).
669689 /// Note that there are some corner cases not fully handled here, so the actual available
670690 /// inbound capacity may be slightly higher than this.
691+ ///
692+ /// This value is not exact. Due to various in-flight changes, feerate changes, and our
693+ /// counterparty's conflict-avoidance policy, exactly this amount is not likely to be spendable.
694+ /// However, our counterparty should be able to spend nearly this amount.
671695 pub inbound_capacity_msat : u64 ,
696+ /// The number of required confirmations on the funding transaction before the funding will be
697+ /// considered "locked". This number is selected by the channel fundee (ie us if
698+ /// [`is_outbound`] is *not* set), and can be selected for inbound channels with
699+ /// [`ChannelHandshakeConfig::minimum_depth`] or limited for outbound channels with
700+ /// [`ChannelHandshakeLimits::max_minimum_depth`].
701+ ///
702+ /// [`is_outbound`]: ChannelDetails::is_outbound
703+ /// [`ChannelHandshakeConfig::minimum_depth`]: crate::util::config::ChannelHandshakeConfig::minimum_depth
704+ /// [`ChannelHandshakeLimits::max_minimum_depth`]: crate::util::config::ChannelHandshakeLimits::max_minimum_depth
705+ pub confirmations_required : u32 ,
706+ /// The number of blocks (after our commitment transaction confirms) which we will need to wait
707+ /// until we can claim our funds after we force-close the channel. During this time our
708+ /// counterparty is allowed to punish us if we broadcasted a stale state. If our counterparty
709+ /// force-closes the channel and broadcasts a commitment transaction we do not have to wait any
710+ /// time to claim our non-HTLC-encumbered funds.
711+ pub to_self_delay : u16 ,
672712 /// True if the channel was initiated (and thus funded) by us.
673713 pub is_outbound : bool ,
674714 /// True if the channel is confirmed, funding_locked messages have been exchanged, and the
675715 /// channel is not currently being shut down. `funding_locked` message exchange implies the
676716 /// required confirmation count has been reached (and we were connected to the peer at some
677- /// point after the funding transaction received enough confirmations).
717+ /// point after the funding transaction received enough confirmations). The required
718+ /// confirmation count is provided in [`confirmations_required`].
719+ ///
720+ /// [`confirmations_required`]: ChannelDetails::confirmations_required
678721 pub is_funding_locked : bool ,
679722 /// True if the channel is (a) confirmed and funding_locked messages have been exchanged, (b)
680723 /// the peer is connected, and (c) the channel is not currently negotiating a shutdown.
@@ -1146,16 +1189,22 @@ impl<Signer: Sign, M: Deref, T: Deref, K: Deref, F: Deref, L: Deref> ChannelMana
11461189 res. reserve ( channel_state. by_id . len ( ) ) ;
11471190 for ( channel_id, channel) in channel_state. by_id . iter ( ) . filter ( f) {
11481191 let ( inbound_capacity_msat, outbound_capacity_msat) = channel. get_inbound_outbound_available_balance_msat ( ) ;
1192+ let ( holder_selected_channel_reserve_satoshis, counterparty_selected_channel_reserve_satoshis) =
1193+ channel. get_holder_counterparty_selected_channel_reserve_satoshis ( ) ;
11491194 res. push ( ChannelDetails {
11501195 channel_id : ( * channel_id) . clone ( ) ,
11511196 funding_txo : channel. get_funding_txo ( ) ,
11521197 short_channel_id : channel. get_short_channel_id ( ) ,
11531198 remote_network_id : channel. get_counterparty_node_id ( ) ,
11541199 counterparty_features : InitFeatures :: empty ( ) ,
11551200 channel_value_satoshis : channel. get_value_satoshis ( ) ,
1201+ counterparty_selected_channel_reserve_satoshis,
1202+ holder_selected_channel_reserve_satoshis,
11561203 inbound_capacity_msat,
11571204 outbound_capacity_msat,
11581205 user_id : channel. get_user_id ( ) ,
1206+ confirmations_required : channel. minimum_depth ( ) ,
1207+ to_self_delay : channel. get_counterparty_selected_contest_delay ( ) ,
11591208 is_outbound : channel. is_outbound ( ) ,
11601209 is_funding_locked : channel. is_usable ( ) ,
11611210 is_usable : channel. is_live ( ) ,
0 commit comments