@@ -656,25 +656,74 @@ pub struct ChannelDetails {
656
656
pub counterparty_features : InitFeatures ,
657
657
/// The value, in satoshis, of this channel as appears in the funding output
658
658
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 ,
659
677
/// The user_id passed in to create_channel, or 0 if the channel was inbound.
660
678
pub user_id : u64 ,
661
679
/// The available outbound capacity for sending HTLCs to the remote peer. This does not include
662
680
/// any pending HTLCs which are not yet fully resolved (and, thus, who's balance is not
663
681
/// available for inclusion in new outbound HTLCs). This further does not include any pending
664
682
/// 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.
665
687
pub outbound_capacity_msat : u64 ,
666
688
/// The available inbound capacity for the remote peer to send HTLCs to us. This does not
667
689
/// include any pending HTLCs which are not yet fully resolved (and, thus, who's balance is not
668
690
/// available for inclusion in new inbound HTLCs).
669
691
/// Note that there are some corner cases not fully handled here, so the actual available
670
692
/// 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.
671
697
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 > ,
672
718
/// True if the channel was initiated (and thus funded) by us.
673
719
pub is_outbound : bool ,
674
720
/// True if the channel is confirmed, funding_locked messages have been exchanged, and the
675
721
/// channel is not currently being shut down. `funding_locked` message exchange implies the
676
722
/// 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
678
727
pub is_funding_locked : bool ,
679
728
/// True if the channel is (a) confirmed and funding_locked messages have been exchanged, (b)
680
729
/// 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
1146
1195
res. reserve ( channel_state. by_id . len ( ) ) ;
1147
1196
for ( channel_id, channel) in channel_state. by_id . iter ( ) . filter ( f) {
1148
1197
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 ( ) ;
1149
1200
res. push ( ChannelDetails {
1150
1201
channel_id : ( * channel_id) . clone ( ) ,
1151
1202
funding_txo : channel. get_funding_txo ( ) ,
1152
1203
short_channel_id : channel. get_short_channel_id ( ) ,
1153
1204
remote_network_id : channel. get_counterparty_node_id ( ) ,
1154
1205
counterparty_features : InitFeatures :: empty ( ) ,
1155
1206
channel_value_satoshis : channel. get_value_satoshis ( ) ,
1207
+ counterparty_selected_channel_reserve_satoshis,
1208
+ holder_selected_channel_reserve_satoshis,
1156
1209
inbound_capacity_msat,
1157
1210
outbound_capacity_msat,
1158
1211
user_id : channel. get_user_id ( ) ,
1212
+ confirmations_required : channel. minimum_depth ( ) ,
1213
+ to_self_delay : channel. get_counterparty_selected_contest_delay ( ) ,
1159
1214
is_outbound : channel. is_outbound ( ) ,
1160
1215
is_funding_locked : channel. is_usable ( ) ,
1161
1216
is_usable : channel. is_live ( ) ,
0 commit comments