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(lightning): proper handle timeouts while receiving a payment #3963

Merged
merged 1 commit into from
Dec 18, 2023

Conversation

douglaz
Copy link
Contributor

@douglaz douglaz commented Dec 16, 2023

#3929 was a mess:

  1. It required fix(client): missing expiry time #3955

  2. It still doesn't fully solve the timeout handling as it calls context.wait_key_exists(ContractKey(contract_id)) which will block until a payment has been received.
    In this situation the client will never timeout because a timeout will be considered an error and it will keep retrying.

  3. It still considers that a DecryptedPreimage::Pending is a good moment to timeout. But in fact if we got DecryptedPreimage::Pending the payment may still succeed, so we can't timeout here.

This PR tries to fix these issues. It also introduces tests for the expiration time check.

Note: this PR should be fully compatible with previous releases. We are just properly using an existing endpoint to solve the issue on the client-side.

Copy link

codecov bot commented Dec 16, 2023

Codecov Report

Attention: 7 lines in your changes are missing coverage. Please review.

Comparison is base (bc4ccf5) 57.08% compared to head (3a77996) 57.07%.

Files Patch % Lines
modules/fedimint-ln-client/src/receive.rs 92.30% 6 Missing ⚠️
modules/fedimint-ln-client/src/lib.rs 50.00% 1 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##           master    #3963      +/-   ##
==========================================
- Coverage   57.08%   57.07%   -0.02%     
==========================================
  Files         193      193              
  Lines       43043    43109      +66     
==========================================
+ Hits        24572    24605      +33     
- Misses      18471    18504      +33     

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

@douglaz douglaz marked this pull request as ready for review December 16, 2023 21:40
@douglaz douglaz requested a review from a team as a code owner December 16, 2023 21:40
Copy link
Contributor

@elsirion elsirion left a comment

Choose a reason for hiding this comment

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

Looks correct, how important is backporting this? @douglaz

Comment on lines +81 to +84
async fn fetch_contract(
&self,
contract: ContractId,
) -> FederationResult<Option<ContractAccount>> {
Copy link
Contributor

Choose a reason for hiding this comment

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

So previously decoding would fail here when None was returned?

@elsirion elsirion added this pull request to the merge queue Dec 18, 2023
Merged via the queue into fedimint:master with commit 0867963 Dec 18, 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