Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 5 additions & 5 deletions app/src/main/java/to/bitkit/ext/ChannelDetails.kt
Original file line number Diff line number Diff line change
Expand Up @@ -8,18 +8,18 @@ import org.lightningdevkit.ldknode.MaxDustHtlcExposure
* Calculates our total balance in the channel (see `value_to_self_msat` in rust-lightning).
*
* This represents the amount we would receive if the channel closes now (excluding fees).
* Matches ldk-node's `ClaimableOnChannelClose.amountSatoshis` (excluding HTLCs).
* Approximates ldk-node's `ClaimableOnChannelClose.amountSatoshis` (excluding HTLCs).
*
* Formula: outbound_capacity + counterparty_reserve
* Formula: outbound_capacity + our_reserve
* - outbound_capacity: What we can spend now over Lightning
* - counterparty_reserve: Their reserve that comes back to us on close
* - our_reserve: Our reserve that we get back on close
*/
val ChannelDetails.amountOnClose: ULong
get() {
val outboundCapacitySat = this.outboundCapacityMsat / 1000u
val counterpartyReserve = this.counterpartyUnspendablePunishmentReserve
val ourReserve = this.unspendablePunishmentReserve ?: 0u

return outboundCapacitySat + counterpartyReserve
return outboundCapacitySat + ourReserve
}

/** Returns only `open` channels, filtering out pending ones. */
Expand Down
Loading