bolts icon indicating copy to clipboard operation
bolts copied to clipboard

Protocol Feature Request: Shift balance between multiple channels with the same peer

Open C-Otto opened this issue 3 years ago • 1 comments

This is a follow-up from https://github.com/lightningnetwork/lnd/issues/5795.

If I have more than one channel with the same peer, I might want to move my balance from one channel to another:

Before:

  • 10M sat on my side of channel A, 5M sat on my side of channel B

After:

  • 15M sat on my side of channel A, nothing on my side of channel B

While routing nodes are free to pick any of the parallel channels to serve a forwarding request (lnd currently picks a random suitable channel), re-organizing the balances directly might be beneficial. One could close channels without changing the overall balance, one could "optimize" two balanced channels by having more sats bundled on each side (to be able to serve larger forwarding requests), or do other kinds of optimizations. The peers might agree to do this free of charge, or charge a fee for this kind of operation.

From a technical point of view I believe this corresponds to a X-Y-X routing request, where the channel for the last hop needs to be used strictly as specified (i.e. not left at the discretion of Y).

C-Otto avatar Nov 23 '21 20:11 C-Otto

Notice that the only way we currently can perform atomic cross-channel is through HTLCs. Since the swap from one channel to another needs to be atomic we likely must actually route the rebalancing payment, otherwise we can end up in a situation where partial swaps may be performed.

This also means that all the potential issues around such a swap/rebalance are already handled (reserve, etc), we just need to signal a rebalance to the peer (so they don't charge fees), and hint that we want a specific channel (TLV signature by the initiating node so we can't get tricked to believe a normal forward is a rebalance, and a flag "please use this exact channel").

cdecker avatar Dec 11 '21 11:12 cdecker