Include an `outbound_payment` flag in `MaybeTimeoutClaimableHTLC` (ChannelMonitor)
https://github.com/lightningdevkit/rust-lightning/pull/2618
Host: dunxen -
Notes
- In PR 2476 the
AvailableBalances::balance_msat
field, which caused confusion due to its strange computation, was removed in favour of usingChannelMonitor::get_claimable_balances
which is more straightforward for most use-cases and indicates balances claimable by the holder after taking on-chain fees into account. - In PR 2333 the
Balance::claimable_amount_satoshis
method was added, which excluded balances that we are unsure can be claimed (i.e. returns0
for those balances). This makes sense on the surface, however, in the case of forwarding an HTLC, we know that we would either be able to claim the timeout balance from downstream or the preimage balance from upstream. Neither of these would be included in this calculation while the forwarded payment was still pending and not timed out. - PR 2618 (this PR) will include the timeout balance (
MaybeTimeoutClaimableHTLC
) but only in the case of forwarded payments. This offers a more accurate view of the claimable balance.
Questions
- Did you review the PR? Concept ACK, approach ACK, tested ACK, or NACK?
- How was the value of the (now removed)
AvailableBalances::balance_msat
field calculated and what was its intended usage? - What do we use instead of
balance_msat
for the above purpose? - Without the use of
balance_msat
how might a developer using LDK calculate an appropriate balance to show to an end-user? - What should the
HTLCSource
of an outbound payment be? And for a forwarded payment? - What other fluctuations in balance do we still have after this PR for forwarded payments? How might we resolve these in a future PR?