Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Lightning cooperative close fee control #9048

Open
gtozzi opened this issue May 13, 2024 · 4 comments
Open

Lightning cooperative close fee control #9048

gtozzi opened this issue May 13, 2024 · 4 comments

Comments

@gtozzi
Copy link

gtozzi commented May 13, 2024

When opening a lightning channel, Electrum (desktop) provides lots of options for customizing the transaction fee and allows the user to preview the funding transaction before signing and broadcasting it.

When cooperatively closing a lightning channel, the fee is established under the hood and the user receives no fee control/confirmation prompt. This usually leads to higher than expected fees (between 2x to 3x the "high priority" estimated next-block fee).

What I would expect to happen:

  1. The user starts the cooperative close procedure
  2. The user receives a prompt with the standard "transaction fee" slider control in Electrum, specifying the max fee the user is willing to pay
  3. (optional) The user reviews and accepts the closure transaction before the other party broadcasts it
@ecdsa
Copy link
Member

ecdsa commented May 13, 2024

when two nodes cooperatively close a channel, they engage in a negotiation in order to decide the fee. If that negotiation fails, one of the nodes will force-close the channel. I do not think we should involve too much user interaction here. For example, what do we do if a fee higher than the user-chosen maximum avoids a force-close?

@gtozzi
Copy link
Author

gtozzi commented May 13, 2024

Does a failed negotiation after a shutdown message has been sent always require failing the channel? Didn't get that.

But in that scenario, then, closing a channel still involves sending a closing_signed transaction with the proposed fee_range so it would be nice if the user could at least preview and approve the proposed fee range even if having no control over it.

If it's not possible to have the user directly manipulate the fee, what about giving him the most information possible and a simple yes/no choice? Something like "Based on current network traffic, closing this channel will cost between 15 and 45 vsat/byte resulting in a final fee between 40 and 120 bits (1-3$). As a comparison, the estimated fee for a force-close is 200 bits instead (5$). Do you want to proceed or wait for better times?"

It would also be nice to display the current close and force-close fee range in the channel details.

@ecdsa
Copy link
Member

ecdsa commented May 13, 2024

not sure it we should always force close. it is quite complex, see:
https://github.com/lightning/bolts/blob/master/02-peer-protocol.md#closing-negotiation-closing_signed

@gtozzi
Copy link
Author

gtozzi commented May 13, 2024

Yup. To my understanding the relevant part is:

if the message contains a fee_range:

    if there is no overlap between that and its own fee_range:
        SHOULD send a warning
        MUST fail the channel if it doesn't receive a satisfying fee_range after a reasonable amount of time

So looks like it is safe in any case to give the user the option to preview the fee range before initiating the close, and it also should be safe to give the user the ability to tune negotiation depending on the definition of "reasonable time".

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants