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

Faster feedback failure receiving invoice (updated) #148

Conversation

mrfelton
Copy link
Contributor

@mrfelton mrfelton commented Aug 3, 2024

Updated version of #122 that has been rebased ontop of latest codebase.

Additionally, it adds:

  • validation of the invoice timeout startup param on startup
  • support for passing invoice response timeout to get-invoice rpc
  • Refactors to use Default instead of custom new_default method, as per pr comment

Copy link

codecov bot commented Aug 3, 2024

Codecov Report

Attention: Patch coverage is 0% with 9 lines in your changes missing coverage. Please review.

Project coverage is 0.00%. Comparing base (6459123) to head (856eb68).

Files Patch % Lines
src/main.rs 0.00% 9 Missing ⚠️
Additional details and impacted files
@@          Coverage Diff           @@
##           master    #148   +/-   ##
======================================
  Coverage    0.00%   0.00%           
======================================
  Files           1       1           
  Lines          97     105    +8     
======================================
- Misses         97     105    +8     

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

@mrfelton mrfelton force-pushed the feat/faster-feedback-failure-receiving-invoice branch 5 times, most recently from 5bbf51d to 174c992 Compare August 5, 2024 06:41
@orbitalturtle orbitalturtle self-requested a review August 9, 2024 02:10
Copy link
Collaborator

@orbitalturtle orbitalturtle left a comment

Choose a reason for hiding this comment

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

Thanks for this! Tested it and it seems to be working well. A few nits below and I think it would be good to squash the three commits into one since the second and third commit are reverting changes that were made in the first commit.

As I'm playing around with LNDK, I'm also starting to feel like 30 seconds is maybe still too long for the timeout. Maybe 15 seconds instead. Any thoughts there?

sample-lndk.conf Outdated Show resolved Hide resolved
src/cli.rs Outdated Show resolved Hide resolved
src/cli.rs Show resolved Hide resolved
src/lib.rs Outdated Show resolved Hide resolved
src/lib.rs Outdated Show resolved Hide resolved
@mrfelton mrfelton force-pushed the feat/faster-feedback-failure-receiving-invoice branch 3 times, most recently from 896edc3 to 25e9378 Compare August 9, 2024 08:35
@mrfelton
Copy link
Contributor Author

mrfelton commented Aug 9, 2024

Addressed all comments in squashed commit 25e9378

As I'm playing around with LNDK, I'm also starting to feel like 30 seconds is maybe still too long for the timeout. Maybe 15 seconds instead. Any thoughts there?

30 seconds is definitely too long in the context of making a payment in the real world. But I don't know what a reasonable expectation is in the context of onion messaging realities. But I've reduced it to 15 seconds in this PR.

I also notice that we have a separate hardcoded 20 second timeout in our connect peer calls, so in reality attempting to fetch an invoice could take 20+15 seconds before a timeout happens.

Copy link
Collaborator

@orbitalturtle orbitalturtle left a comment

Choose a reason for hiding this comment

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

Just one more nit and then good to go

src/cli.rs Outdated Show resolved Hide resolved
@mrfelton mrfelton force-pushed the feat/faster-feedback-failure-receiving-invoice branch 2 times, most recently from a9e864f to 3e58b4d Compare August 9, 2024 20:07
@orbitalturtle
Copy link
Collaborator

@mrfelton Just needs a cargo fmt!

I also notice that we have a separate hardcoded 20 second timeout in our connect peer calls, so in reality attempting to fetch an invoice could take 20+15 seconds before a timeout happens.

Actually if we hit the connect_peer timeout, the payment should just fail and not reach the 15s timeout. But it definitely might be worth adding another timeout config option if people need it eventually.

This commit introduces a parameter in the RPC to allow users to modify
the timeout when receiving an invoice from the offer creator.

Additionally, it adds a configuration parameter for the server to set
up a default value if no parameter is used.

The default timeout value is also decreased from 100 seconds to 20
seconds.
@mrfelton mrfelton force-pushed the feat/faster-feedback-failure-receiving-invoice branch from 3e58b4d to 856eb68 Compare August 9, 2024 20:41
@mrfelton
Copy link
Contributor Author

mrfelton commented Aug 9, 2024

re-pushed with format

@orbitalturtle orbitalturtle added this to the 0.2.0 milestone Aug 9, 2024
@mrfelton
Copy link
Contributor Author

mrfelton commented Aug 9, 2024

Actually if we hit the connect_peer timeout, the payment should just fail and not reach the 15s timeout. But it definitely might be worth adding another timeout config option if people need it eventually.

I would think it more rare that connecting to a peer would take longer than a second or two. It's the onion message exchange that seems to take time. Possibly what we need more than configurable timeouts on the peer connect would be fallbacks to connecting to other peers if we can't connect directly to the first one we attempt.

@orbitalturtle orbitalturtle merged commit 9c5727f into lndk-org:master Aug 9, 2024
10 checks passed
@orbitalturtle
Copy link
Collaborator

Possibly what we need more than configurable timeouts on the peer connect would be fallbacks to connecting to other peers if we can't connect directly to the first one we attempt.

Yeah good point! If an offer includes more than one blinded path option, we should loop through the other options in the case of a connection failure. This is relevant to a PR I'm working on now so I'll try to include it.

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.

3 participants