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

Yield call to send_payment after a timeout and return a pending payment #943

Draft
wants to merge 2 commits into
base: main
Choose a base branch
from

Conversation

dangeross
Copy link
Collaborator

@dangeross dangeross commented Apr 23, 2024

This adds the following to the SDK:

  • A PaymentStarted event to notify to beginning of a payment.
  • Run the send_payment() request in a thread with a timeout to prevent the method call hanging too long. If it times out, the pending Payment is returned and the client can then use the PaymentSucceed / PaymentFailed events to handle the completion of the payment.
  • Run the lnurl_pay() request (which uses send_payment()) without a timeout.

@dangeross dangeross force-pushed the savage-send-payment-yield branch from 772e7f7 to 1128f90 Compare April 23, 2024 13:19
@dangeross dangeross requested review from roeierez and ok300 April 24, 2024 15:32
@dangeross dangeross marked this pull request as ready for review April 24, 2024 15:32
libs/sdk-core/src/models.rs Outdated Show resolved Hide resolved
libs/sdk-core/src/breez_services.rs Outdated Show resolved Hide resolved
@dangeross dangeross force-pushed the savage-send-payment-yield branch from 4a730da to fd46a2f Compare April 30, 2024 07:26
@dangeross dangeross force-pushed the savage-send-payment-yield branch from fd46a2f to cd99a34 Compare April 30, 2024 08:11
Copy link
Member

@roeierez roeierez left a comment

Choose a reason for hiding this comment

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

A small simplification suggested.

@@ -749,6 +750,7 @@ dictionary SendPaymentRequest {
string bolt11;
u64? amount_msat = null;
string? label = null;
u64? pending_timeout_sec = null;
Copy link
Member

Choose a reason for hiding this comment

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

Do we need this? Why not using the payment_timeout from the config?

libs/sdk-core/src/breez_services.rs Show resolved Hide resolved
@dangeross dangeross marked this pull request as draft May 2, 2024 15:02
@ok300
Copy link
Contributor

ok300 commented Jun 3, 2024

The failing tests would be fixed by #958

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