lnd icon indicating copy to clipboard operation
lnd copied to clipboard

contractcourt+routing: create optional runtime config to never go to chain for purely outbound HTLCs

Open Roasbeef opened this issue 1 year ago • 2 comments

Today, if we make an outgoing payment, and it never gets canceled back, we'll eventually try to go on chain to claim the HTLC ourselves. This makes sense to do in most scenarios (*), but if this is a "leaf node" or the outgoing HTLC was created by our node, then we aren't at risk at all if we don't go to chain ASAP. Instead, we can just leave the HTLC on the commitment transaction, maybe it gets cancelled back. If not, we do have the opportunity cost of not being able to use that suspended HTLC amount for further payments. At a certain point, our slots might full up, so we'd be forced to do so.

Steps To Completion

  • [ ] Add new config option detailed above.

  • [ ] Update the ChannelArb to indirectly have access to the switch's circuit map state.

  • [ ] Use that new state within the shouldGoToChain function to defer going to chain if the HTLC has expired, but it's a pure outgoing HTLC (the incoming key in the circuit map is all zeroes).

Roasbeef avatar Jan 31 '24 01:01 Roasbeef

Maybe we could aim this for 0.19 along with #1226?

yyforyongyu avatar Jan 31 '24 03:01 yyforyongyu

This would massively improve the UX for mobile LND users

kaloudis avatar Feb 02 '24 18:02 kaloudis