-
Notifications
You must be signed in to change notification settings - Fork 91
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
Only avoid duplicate payments if we didn't fail sending (and expose list_payments
)
#96
Conversation
b0ff3c8
to
c4f49c4
Compare
Rebased after #85 landed. |
c4f49c4
to
94e87e5
Compare
status: PaymentStatus::SendingFailed, | ||
}; | ||
|
||
self.payment_store.insert(payment)?; |
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.
So we have any tests that check the payment store? Might be worth adding a test case for duplicate payments.
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.
Ah, but checking that we fail to send duplicate payments is already covered in channel_full_cycle
? Not entirely sure how we'd check the behavior on the payment store alone as the logic for handling duplicates lives (and has to live I think) in send_payment
.
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.
But we don't check that the status remains the same as before in case of a duplicate error, IIUC.
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.
Ah, fair enough, now asserting that the payment details are unchanged after we receive Error::DuplicatePayment
.
94e87e5
to
4a9cc01
Compare
Rebased on main. |
4a9cc01
to
f3e5658
Compare
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.
LGTM. Please squash.
Previously, we denied retrying any payment for which we already had seen the payment hash. However, this is rather invasive as payments might fail due to local connections issues or unavailability of usable channels, in which case the invoices/payment hashes would be 'burnt' and couldn't get retried. Here, we introduce a new `PaymentStatus::SendingFailed` to differentiate send failures and allow retrying tracked payments if they failed to send immediately. We also rename some error types accordingly for further clarification.
f3e5658
to
ecd1b64
Compare
Squashed without further changes. |
Previously, we went from not tracking payments when they immediately failed to send to always tracking them but denying any retries for payments whose payment hash was known to us. However, this is of course much too restrictive as payments might fail due to local connections issues or unavailability of usable channels, in which case the invoices/payment hashes would be 'burnt' and couldn't get retried.
Here, we introduce a new
PaymentStatus::SendingFailed
to differentiate send failures and allow retrying tracked payments if they failed to send immediately. We also rename some error types accordingly for further clarification.Additionally, we expose a simple
Node::list_payments
variant, mainly to be used in bindings where we can't make use of the_with_filter
variant.