@@ -868,17 +868,30 @@ pub struct ChannelDetails {
868868 pub unspendable_punishment_reserve : Option < u64 > ,
869869 /// The `user_channel_id` passed in to create_channel, or 0 if the channel was inbound.
870870 pub user_channel_id : u64 ,
871+ /// Our total balance. This is the amount we would get if we close the channel.
872+ /// This does not include any pending HTLCs which are not yet fully resolved (and, thus, whose
873+ /// balance is not available for inclusion in new outbound HTLCs). This further does not include
874+ /// any pending outgoing HTLCs which are awaiting some other resolution to be sent.
875+ /// This does not consider any on-chain fees.
876+ ///
877+ /// See also [`ChannelDetails::outbound_capacity_msat`]
878+ ///
879+ /// This value is not exact. Due to various in-flight changes, feerate changes, and our
880+ /// conflict-avoidance policy, exactly this amount is not likely to be recoverable on close.
881+ pub balance_msat : u64 ,
871882 /// The available outbound capacity for sending HTLCs to the remote peer. This does not include
872- /// any pending HTLCs which are not yet fully resolved (and, thus, who's balance is not
883+ /// any pending HTLCs which are not yet fully resolved (and, thus, whose balance is not
873884 /// available for inclusion in new outbound HTLCs). This further does not include any pending
874885 /// outgoing HTLCs which are awaiting some other resolution to be sent.
875886 ///
887+ /// See also [`ChannelDetails::balance_msat`]
888+ ///
876889 /// This value is not exact. Due to various in-flight changes, feerate changes, and our
877890 /// conflict-avoidance policy, exactly this amount is not likely to be spendable. However, we
878891 /// should be able to spend nearly this amount.
879892 pub outbound_capacity_msat : u64 ,
880893 /// The available inbound capacity for the remote peer to send HTLCs to us. This does not
881- /// include any pending HTLCs which are not yet fully resolved (and, thus, who's balance is not
894+ /// include any pending HTLCs which are not yet fully resolved (and, thus, whose balance is not
882895 /// available for inclusion in new inbound HTLCs).
883896 /// Note that there are some corner cases not fully handled here, so the actual available
884897 /// inbound capacity may be slightly higher than this.
@@ -1449,6 +1462,7 @@ impl<Signer: Sign, M: Deref, T: Deref, K: Deref, F: Deref, L: Deref> ChannelMana
14491462 res. reserve ( channel_state. by_id . len ( ) ) ;
14501463 for ( channel_id, channel) in channel_state. by_id . iter ( ) . filter ( f) {
14511464 let ( inbound_capacity_msat, outbound_capacity_msat) = channel. get_inbound_outbound_available_balance_msat ( ) ;
1465+ let balance_msat = channel. get_balance_msat ( ) ;
14521466 let ( to_remote_reserve_satoshis, to_self_reserve_satoshis) =
14531467 channel. get_holder_counterparty_selected_channel_reserve_satoshis ( ) ;
14541468 res. push ( ChannelDetails {
@@ -1463,6 +1477,7 @@ impl<Signer: Sign, M: Deref, T: Deref, K: Deref, F: Deref, L: Deref> ChannelMana
14631477 short_channel_id : channel. get_short_channel_id ( ) ,
14641478 channel_value_satoshis : channel. get_value_satoshis ( ) ,
14651479 unspendable_punishment_reserve : to_self_reserve_satoshis,
1480+ balance_msat,
14661481 inbound_capacity_msat,
14671482 outbound_capacity_msat,
14681483 user_channel_id : channel. get_user_id ( ) ,
0 commit comments