Treat monitor-held spontaneous payments as in flight - #33
Draft
Jainakin wants to merge 1 commit into
Draft
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Treat a spontaneous payment with a partially accepted route as in flight instead of reporting a resend-safe failure.
Root cause
pay_route_internal()returnsPaymentSendFailure::PartialFailurewhen at least one path has entered the channel state machine but cannot be released yet, includingAPIError::MonitorUpdateInProgress. The existing wrapper converted every error intoRetryableSendFailure::RouteNotFound, emittedPaymentFailed, and allowed callers to retry while the original HTLC was still pending.That behavior can duplicate a payment attempt across a monitor-persistence boundary.
Change
PartialFailure, preserving the pending outbound payment.PaymentFailedfor an in-flight partial result.MonitorUpdateInProgress.Validation
cargo check -p lightning --lib --features _rln_test_hookspasses on currentdev.Current
devcannot compile its unit-test target independently because the UTEXO fork has pre-existing disabled test utilities/macros. The attempted focused invocation fails in unrelated test modules before this test can run. #32 restores that test harness; this limitation is stated here rather than hidden.Relationship to #32
#32 already contains this safety fix because it was discovered while exercising delayed monitor persistence. This narrow PR exists so the payment semantic can be reviewed independently. If accepted first, #32 should be rebased to drop the duplicate hunk.