Include an `outbound_payment` flag in `MaybeTimeoutClaimableHTLC` (ChannelMonitor)

https://github.com/lightningdevkit/rust-lightning/pull/2618

Host: dunxen  -  PR author: TheBlueMatt

Notes

  • In PR 2476 the AvailableBalances::balance_msat field, which caused confusion due to its strange computation, was removed in favour of using ChannelMonitor::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. returns 0 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

  1. Did you review the PR? Concept ACK, approach ACK, tested ACK, or NACK?
  2. How was the value of the (now removed) AvailableBalances::balance_msat field calculated and what was its intended usage?
  3. What do we use instead of balance_msat for the above purpose?
  4. Without the use of balance_msat how might a developer using LDK calculate an appropriate balance to show to an end-user?
  5. What should the HTLCSource of an outbound payment be? And for a forwarded payment?
  6. What other fluctuations in balance do we still have after this PR for forwarded payments? How might we resolve these in a future PR?