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

feat: better invoice expiration #3927

Merged
merged 1 commit into from
Dec 13, 2023

Conversation

douglaz
Copy link
Contributor

@douglaz douglaz commented Dec 12, 2023

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.

@douglaz douglaz requested a review from a team as a code owner December 12, 2023 19:19
@douglaz douglaz requested a review from a team December 12, 2023 19:19
Copy link

codecov bot commented Dec 12, 2023

Codecov Report

All modified and coverable lines are covered by tests ✅

Comparison is base (83c8f51) 57.10% compared to head (5142e28) 57.09%.

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.
📢 Have feedback on the report? Share it here.

@elsirion
Copy link
Contributor

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.

@douglaz
Copy link
Contributor Author

douglaz commented Dec 13, 2023

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 Some(expiry_time) instead of None. This default is only for clueless wallets and integrators.

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()),
Copy link
Contributor

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.

Copy link
Contributor

@dpc dpc left a 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.

@elsirion
Copy link
Contributor

@douglaz oh, you are right, I was just confused.

@elsirion elsirion added this pull request to the merge queue Dec 13, 2023
Merged via the queue into fedimint:master with commit 577ed73 Dec 13, 2023
20 checks passed
@douglaz douglaz deleted the change_default_expire_time branch December 13, 2023 12:48
@justinmoon
Copy link
Contributor

Default expiration of 24 hours sounds good to me

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

Successfully merging this pull request may close these issues.

None yet

4 participants