Skip to content

fix(payment): skip store insertion on routing failures to allow retry#906

Open
alexgrad42 wants to merge 1 commit into
lightningdevkit:mainfrom
alexgrad42:feature/no_store_update_for_fail_finding_route
Open

fix(payment): skip store insertion on routing failures to allow retry#906
alexgrad42 wants to merge 1 commit into
lightningdevkit:mainfrom
alexgrad42:feature/no_store_update_for_fail_finding_route

Conversation

@alexgrad42
Copy link
Copy Markdown

Adjust the error handling for outbound payments so that when a payment fails at the pathfinding stage (e.g., RetryableSendFailure::RouteNotFound), we bypass inserting a PaymentStatus::Failed entry into the database.

Fix #903

@ldk-reviews-bot
Copy link
Copy Markdown

ldk-reviews-bot commented May 17, 2026

I've assigned @tnull as a reviewer!
I'll wait for their review and will help manage the review process.
Once they submit their review, I'll check if a second reviewer would be helpful.

@alexgrad42 alexgrad42 force-pushed the feature/no_store_update_for_fail_finding_route branch from 09c0a1f to c9d3974 Compare May 17, 2026 11:42
@alexgrad42 alexgrad42 marked this pull request as ready for review May 17, 2026 12:14
@ldk-reviews-bot ldk-reviews-bot requested a review from tnull May 17, 2026 12:15
@ldk-reviews-bot
Copy link
Copy Markdown

🔔 1st Reminder

Hey @tnull! This PR has been waiting for your review.
Please take a look when you have a chance. If you're unable to review, please let us know so we can find another reviewer.

Copy link
Copy Markdown
Contributor

@benthecarman benthecarman left a comment

Choose a reason for hiding this comment

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

I think we already handle this, the test passes for me without your changes or at least the test doesn't actually cover the issue you're trying to fix

@ldk-reviews-bot
Copy link
Copy Markdown

🔔 2nd Reminder

Hey @tnull! This PR has been waiting for your review.
Please take a look when you have a chance. If you're unable to review, please let us know so we can find another reviewer.

@ldk-reviews-bot
Copy link
Copy Markdown

🔔 3rd Reminder

Hey @tnull! This PR has been waiting for your review.
Please take a look when you have a chance. If you're unable to review, please let us know so we can find another reviewer.

Adjust the error handling for outbound payments so that when a payment
fails at the pathfinding stage (e.g., `RetryableSendFailure::RouteNotFound`),
we bypass inserting a `PaymentStatus::Failed` entry into the database.

Fix lightningdevkit#903
@alexgrad42 alexgrad42 force-pushed the feature/no_store_update_for_fail_finding_route branch from c9d3974 to 894ceb6 Compare May 24, 2026 05:52
@alexgrad42
Copy link
Copy Markdown
Author

alexgrad42 commented May 24, 2026

**benthecarman **

Thanks for the review. Although the issue explicitly mentions DuplicatePayment, in the current implementation the send() method actually allows a retry if the payment status in the store is set to Failed. The underlying logic was that a RouteNotFound error would persist a redundant Failed payment record to the database, even though the HTLC was never sent out. I've updated the test to ensure that the payment store remains clean after a routing failure.

I'll leave it up to you to decide whether we should keep this exact check or modify it (e.g., make it configurable).

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.

Should we update payment store if we fail finding a route?

3 participants