-
Notifications
You must be signed in to change notification settings - Fork 89
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(backend): Check quote expiry in outgoing payment worker (#3141) #3173
base: main
Are you sure you want to change the base?
Conversation
feat(backend):Check quote expiry in outgoing payment worker (interledger#3141)
✅ Deploy Preview for brilliant-pasca-3e80ec canceled.
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thank you for the PR @CollinsMunene !
@@ -17,6 +17,11 @@ export async function handleSending( | |||
): Promise<void> { | |||
if (!payment.quote) throw LifecycleError.MissingQuote | |||
|
|||
// Check if the current time is greater than or equal to when the Quote should be expiring |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Let's add a test for this case
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hi Max, I have been looking to add the test here at (service.test.ts) potentially something similar to ('processNext' test) or ('fund').
Is this correct?
Check quote expiry in outgoing payment worker (#3141)
Context
Currently, we check the expiresAt of the quote during outgoing payment creation. If it is valid, we create the outgoing payment, store it in the DB.
Once the payment is funded, the outgoing payments worker starts processing the payment, whether that is local or over ILP. If the payment fails, it will stay in the SENDING state and the worker will keep retrying it (up to some maximum number of times).
In the worker, however, we do not check the expiry of the quote. The quote could expire between the time when we created the payment, and when it is being processed (or retried) in the worker. We should prevent processing an outgoing payment for an expired quote. (good spot would be in lifecycle.ts > handleSending)
Also, so as to enable better error handling and debugging, we should add a new lifecycle error for showing quote has expired.
Checklist