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

fix(client): missing expiry time #3955

Merged
merged 1 commit into from
Dec 15, 2023
Merged

Conversation

douglaz
Copy link
Contributor

@douglaz douglaz commented Dec 15, 2023

No description provided.

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.

Wooops.

@dpc dpc enabled auto-merge December 15, 2023 16:49
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.

Maybe I need more coffee but since it had a bug and I still has trouble reading maybe we should either add a test, or figure out some way to make this code obviously correct.

let invoice_since_epoch = invoice.duration_since_epoch() + TOLERANCE;
if now_since_epoch > invoice_since_epoch {
let invoice_expiration_epoch =
invoice.duration_since_epoch() + invoice.expiry_time() + TOLERANCE;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

thought: So here we add "duration" + "time" + "tolerance (duration)", so what's confusing is that (I guess, expiry_time is "duration", while duration_since_epoch is actually "(absolute) time"). :D.

if now_since_epoch > invoice_since_epoch {
let invoice_expiration_epoch =
invoice.duration_since_epoch() + invoice.expiry_time() + TOLERANCE;
if now_since_epoch > invoice_expiration_epoch {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

thought: And now we call on3e thin _since_epoch and the other _epoch which also seems meh. :D

@dpc
Copy link
Contributor

dpc commented Dec 15, 2023

I guess we'll want a quick backport and release of this, as is makes all ln payments have 60s deadlines?

Copy link

codecov bot commented Dec 15, 2023

Codecov Report

All modified and coverable lines are covered by tests ✅

Comparison is base (5c293e4) 57.07% compared to head (2829c1b) 57.03%.

Additional details and impacted files
@@            Coverage Diff             @@
##           master    #3955      +/-   ##
==========================================
- Coverage   57.07%   57.03%   -0.05%     
==========================================
  Files         193      193              
  Lines       43041    43042       +1     
==========================================
- Hits        24566    24547      -19     
- Misses      18475    18495      +20     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

let invoice_since_epoch = invoice.duration_since_epoch() + TOLERANCE;
if now_since_epoch > invoice_since_epoch {
let invoice_expiration_epoch =
invoice.duration_since_epoch() + invoice.expiry_time() + TOLERANCE;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

thought: BTW. If this 3 lines were in a method, than I think we could have a really tiny unit test that crafts a fake invoice and then checks against values against and after the timeout.

@dpc dpc added this pull request to the merge queue Dec 15, 2023
Merged via the queue into fedimint:master with commit 6d58a2e Dec 15, 2023
22 checks passed
@fedimint-backports
Copy link

Successfully created backport PR for releases/v0.2:

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

Successfully merging this pull request may close these issues.

None yet

4 participants