-
Notifications
You must be signed in to change notification settings - Fork 2.1k
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
invoices+channeldb: reject payments to expired invoices #3694
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Solid fix! Nice to finally patch this behavior. No major comments on my end, just mostly relevant areas of the contribution/style guide that aren't fully adhere to.
An example of a better PR title would've been something along the lines of:
invoices+channeldb: reject payments to expired invoices
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Perhaps not in this PR, but eventually we also may want to actively cancel invoices when they expire. So that there state is reflectly properly even without someone paying to them first.
Working on a different timer in #3415 using a priority queue |
Can we change the default invoice time to be higher than an hour? How about 3 hours? Otherwise I anticipate this change resulting in some error rate increases. |
Why would error rates increase? The sender already checks the expiry now. Or are you thinking about other implementations that may not do this? Or people decoding the pay req and using |
There is decoding and sending yes, but there is also a natural race condition between acceptance and sending. It can easily take me 10 minutes to complete a payment to some destinations, but the timer would have shown "you have 10 minutes left" when I pressed the button. Clocks may not be perfectly synchronized, etc. |
What does changing the default fix about this? The problem remains, only with a different time. |
I didn't say it fixed it, it just can counterbalance it |
I would prefer this being a follow up. Can also make an issue on it for someone to pick up. |
@bhandras and I discussed this offline. Both approaches aren't compatible with each other, so doesn't work very well as a follow up. |
Even though the original issue is solved with the current PR, as discussed with @joostjager, it is cleaner to implement a watcher for invoice expiry and cancellation. I'll update this PR soon. |
Here is a data point on how many errors are due to expiry
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM 🐌
This commits builds on top of PR lightningnetwork#3694 to further clarify invoice state by defining pending invoices as the ones which are not settled or canceled. Automatic cancellation of expired invoices makes this possbile. While this change only directly affects ChannelDB, users of the listinvoices RPC will receive actual pending invoices when pending_only flag is set.
This commits builds on top of PR lightningnetwork#3694 to further clarify invoice state by defining pending invoices as the ones which are not settled or canceled. Automatic cancellation of expired invoices makes this possbile. While this change only directly affects ChannelDB, users of the listinvoices RPC will receive actual pending invoices when pending_only flag is set.
invoices+channeldb: reject payments to expired invoices
This change is