@@ -868,17 +868,30 @@ pub struct ChannelDetails {
868
868
pub unspendable_punishment_reserve : Option < u64 > ,
869
869
/// The `user_channel_id` passed in to create_channel, or 0 if the channel was inbound.
870
870
pub user_channel_id : u64 ,
871
+ /// Our total balance. This is the amount we would get if we close the channel.
872
+ /// This value is not exact. Due to various in-flight changes and feerate changes, exactly this
873
+ /// amount is not likely to be recoverable on close.
874
+ ///
875
+ /// This does not include any pending HTLCs which are not yet fully resolved (and, thus, whose
876
+ /// balance is not available for inclusion in new outbound HTLCs). This further does not include
877
+ /// any pending outgoing HTLCs which are awaiting some other resolution to be sent.
878
+ /// This does not consider any on-chain fees.
879
+ ///
880
+ /// See also [`ChannelDetails::outbound_capacity_msat`]
881
+ pub balance_msat : u64 ,
871
882
/// 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
873
884
/// available for inclusion in new outbound HTLCs). This further does not include any pending
874
885
/// outgoing HTLCs which are awaiting some other resolution to be sent.
875
886
///
887
+ /// See also [`ChannelDetails::balance_msat`]
888
+ ///
876
889
/// This value is not exact. Due to various in-flight changes, feerate changes, and our
877
890
/// conflict-avoidance policy, exactly this amount is not likely to be spendable. However, we
878
891
/// should be able to spend nearly this amount.
879
892
pub outbound_capacity_msat : u64 ,
880
893
/// 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
882
895
/// available for inclusion in new inbound HTLCs).
883
896
/// Note that there are some corner cases not fully handled here, so the actual available
884
897
/// 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
1449
1462
res. reserve ( channel_state. by_id . len ( ) ) ;
1450
1463
for ( channel_id, channel) in channel_state. by_id . iter ( ) . filter ( f) {
1451
1464
let ( inbound_capacity_msat, outbound_capacity_msat) = channel. get_inbound_outbound_available_balance_msat ( ) ;
1465
+ let balance_msat = channel. get_balance_msat ( ) ;
1452
1466
let ( to_remote_reserve_satoshis, to_self_reserve_satoshis) =
1453
1467
channel. get_holder_counterparty_selected_channel_reserve_satoshis ( ) ;
1454
1468
res. push ( ChannelDetails {
@@ -1463,6 +1477,7 @@ impl<Signer: Sign, M: Deref, T: Deref, K: Deref, F: Deref, L: Deref> ChannelMana
1463
1477
short_channel_id : channel. get_short_channel_id ( ) ,
1464
1478
channel_value_satoshis : channel. get_value_satoshis ( ) ,
1465
1479
unspendable_punishment_reserve : to_self_reserve_satoshis,
1480
+ balance_msat,
1466
1481
inbound_capacity_msat,
1467
1482
outbound_capacity_msat,
1468
1483
user_channel_id : channel. get_user_id ( ) ,
0 commit comments