| 
 | 1 | +---  | 
 | 2 | +layout: pr  | 
 | 3 | +date: 2023-09-29  | 
 | 4 | +title: "Include an `outbound_payment` flag in `MaybeTimeoutClaimableHTLC`"  | 
 | 5 | +pr: 2618  | 
 | 6 | +authors: [TheBlueMatt]  | 
 | 7 | +components: ["ChannelMonitor"]  | 
 | 8 | +host: dunxen  | 
 | 9 | +status: upcoming  | 
 | 10 | +commit:  | 
 | 11 | +---  | 
 | 12 | + | 
 | 13 | +## Notes  | 
 | 14 | + | 
 | 15 | +* In [PR 2476] the [`AvailableBalances::balance_msat`] field, which caused confusion due to its strange computation, was removed in favour of  | 
 | 16 | +  using `ChannelMonitor::get_claimable_balances` which is more straightforward for most use-cases and indicates balances claimable by the holder  | 
 | 17 | +  after taking on-chain fees into account.  | 
 | 18 | +* 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).  | 
 | 19 | +  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  | 
 | 20 | +  downstream or the preimage balance from upstream. Neither of these would be included in this calculation while the forwarded payment was still pending  | 
 | 21 | +  and not timed out.  | 
 | 22 | +* [PR 2618] (this PR) will include the timeout balance (`MaybeTimeoutClaimableHTLC`) but only in the case of forwarded payments. This offers a more accurate  | 
 | 23 | +  view of the claimable balance.  | 
 | 24 | + | 
 | 25 | + | 
 | 26 | +## Questions  | 
 | 27 | +1. Did you review the PR? [Concept ACK, approach ACK, tested ACK, or NACK](https://github.com/lightningdevkit/rust-lightning/blob/master/CONTRIBUTING.md#peer-review)?  | 
 | 28 | +1. How was the value of the (now removed) `AvailableBalances::balance_msat` field calculated and what was its intended usage?  | 
 | 29 | +1. What do we use instead of `balance_msat` for the above purpose?  | 
 | 30 | +1. Without the use of `balance_msat` how might a developer using LDK calculate an appropriate balance to show to an end-user?   | 
 | 31 | +1. What should the `HTLCSource` of an outbound payment be? And for a forwarded payment?  | 
 | 32 | +1. What other fluctuations in balance do we still have after this PR for forwarded payments? How might we resolve these in a future PR?  | 
 | 33 | + | 
 | 34 | +[PR 2476]: https://github.com/lightningdevkit/rust-lightning/pull/2476  | 
 | 35 | +[PR 2333]: https://github.com/lightningdevkit/rust-lightning/pull/2333  | 
 | 36 | +[PR 2618]: https://github.com/lightningdevkit/rust-lightning/pull/2618  | 
 | 37 | +[`AvailableBalances::balance_msat`]: https://github.com/lightningdevkit/rust-lightning/blob/7a63ab77da7e0be35b1c5d87643e5461cd593b94/lightning/src/ln/channel.rs#L69  | 
 | 38 | +[`Balance::claimable_amount_satoshis`]: https://github.com/lightningdevkit/rust-lightning/blob/6016101ac8ff31275f31f68eef8d33e94b19c0b1/lightning/src/chain/channelmonitor.rs#L658  | 
0 commit comments