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

Receive onchain doesn't work if the user's channel was closed #955

Open
JssDWt opened this issue Apr 29, 2024 · 3 comments
Open

Receive onchain doesn't work if the user's channel was closed #955

JssDWt opened this issue Apr 29, 2024 · 3 comments

Comments

@JssDWt
Copy link
Contributor

JssDWt commented Apr 29, 2024

Problem statement:

  • user has a channel with sufficient inbound liquidity to receive a swap payment.
  • user creates swap
  • Invoice is created with a route hint to the user's channel
  • User's channel closes (or node was unaware of the channel closure)
  • Now the swap is unpayable

Thinking about how we should be able to handle this scenario.

  • If we find out the channel for this invoice closed, maybe we should notify the user this swap has become unpayable, so the user shouldn't send onchain funds to it.
  • Ideally we would always regenerate the invoice for the swap for every redeem. That would ensure there is always a working route hint in the invoice. In this case, however, the new invoice would have to pay for a channel open, something the user didn't ask for.

Issue for greenlight: Blockstream/greenlight#419

@kingonly
Copy link
Member

I thought we are generating the invoice on every redeem, however we can't easily solve the "pay again for a new channel" use case.

@JssDWt
Copy link
Contributor Author

JssDWt commented Apr 29, 2024

I thought we are generating the invoice on every redeem

We're not. The problem is the invoice is persisted on the greenlight node and you can't add another one with the same preimage. A solution could be deleting the invoice and creating a new one. But his could run into race conditions. This is why we ensure there is always a route hint in the invoice now, and we're able to recover if the invoice is not in our local storage, but it's still the same invoice on the node.

@roeierez
Copy link
Member

@JssDWt as you mentioned I am not sure we should change the invoice from one that doesn't open a channel to one that does. From the reason you said the user didn't see the opening fees.
As for a case where there are channels with enough inbound capacity (after the closure) the lsp is free to choose them for the forward as long as they meet the route policy.

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

3 participants