-
Notifications
You must be signed in to change notification settings - Fork 210
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
feat: better invoice expiration #3927
Conversation
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## master #3927 +/- ##
==========================================
- Coverage 57.10% 57.09% -0.02%
==========================================
Files 193 193
Lines 42907 42907
==========================================
- Hits 24503 24498 -5
- Misses 18404 18409 +5 ☔ View full report in Codecov by Sentry. |
Should it just be configurable instead? Let the integrator worry about that: they can choose a default or give the user a way to configure it. |
It's already configurable: just use But one option is to not let it be optional. Then everyone will be required to make a decision. |
@@ -770,7 +773,7 @@ impl LightningClientModule { | |||
.min_final_cltv_expiry_delta(18) | |||
.payee_pub_key(node_public_key) | |||
.expiry_time(Duration::from_secs( | |||
expiry_time.unwrap_or(DEFAULT_EXPIRY_TIME), | |||
expiry_time.unwrap_or(DEFAULT_INVOICE_EXPIRY_TIME.as_secs()), |
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.
nitpick: That conversion back and forth from/to Duration
looks weird. Would expire_time.map(Duration::from_secs).unwrap_or(DEFAULT_INVOICE_EXPIRY_TIME)
work? I would just do somewhere before:
let expire_time = expire_type.map(Duration::from_secs);
to get it of the way, then expire_time.unwrap_or(DEFAULT_INVOICE_EXPIRY_TIME)
would work just perfectly.
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.
No idea if this is a good idea, but technically PR LGTM.
@douglaz oh, you are right, I was just confused. |
Default expiration of 24 hours sounds good to me |
Anyone that has used lightning in the real world has probably suffered with the usual 1 hour default expiration time on invoices. Let's help a bit the users by giving them a better default.