Skip to content

fix(send): preserve pending send failure details - #663

Open
pwltr wants to merge 1 commit into
masterfrom
fix/reset-routing
Open

fix(send): preserve pending send failure details#663
pwltr wants to merge 1 commit into
masterfrom
fix/reset-routing

Conversation

@pwltr

@pwltr pwltr commented Aug 12, 2026

Copy link
Copy Markdown
Contributor

Summary

  • Preserve the LDK PaymentFailureReason when a Lightning payment times out into Pending and later fails.
  • Pass pending payment context through to the failure screen so it shows the correct localized failure message.
  • Keep routing-cache reset retry eligibility intact for pending failures like routeNotFound and retriesExhausted.
  • Carry the BOLT11 through the pending route so the support report prefill still has payment context.

Follow-up to #652, no changelog entry needed.

Simulator.Screen.Recording.-.iPhone.17.-.2026-08-12.at.14.28.39.mov

@greptile-apps

greptile-apps Bot commented Aug 12, 2026

Copy link
Copy Markdown

Greptile Summary

This PR preserves Lightning payment failure details and invoice context when a timed-out payment later resolves as failed.

  • Adds the optional LDK failure reason to pending-payment resolutions.
  • Builds pending failure contexts from the preserved reason so localized messaging and routing-cache retry behavior match immediate failures.
  • Carries the BOLT11 through pending routes for support-report prefill.
  • Propagates the existing routing-cache-reset attempt state into pending failure handling.

Confidence Score: 5/5

The PR appears safe to merge, with pending failures now consistently retaining their failure and support-report context.

The changed flow preserves optional failure reasons without introducing an unsafe nil path, retains existing routing-cache retry semantics, and associates each pending route with the invoice used for that payment.

Important Files Changed

Filename Overview
Bitkit/ViewModels/AppViewModel.swift Preserves the optional LDK failure reason when resolving a registered pending payment.
Bitkit/Views/Wallets/Send/SendPendingScreen.swift Converts the preserved reason into the standard failure context and forwards retry and invoice context.
Bitkit/Views/Wallets/Send/SendSheet.swift Extends pending routes with optional payment-request context and supplies existing routing-cache retry state.
Bitkit/Views/Wallets/Send/SendConfirmationView.swift Captures the invoice BOLT11 when a standard Lightning send transitions to pending.
Bitkit/Views/Wallets/Send/LnurlPayConfirm.swift Captures the generated LNURL-pay BOLT11 when the payment transitions to pending.
Bitkit/Views/Wallets/Send/SendQuickpay.swift Captures the quick-pay BOLT11 when the payment transitions to pending.

Sequence Diagram

sequenceDiagram
    participant Send as Send screen
    participant App as AppViewModel
    participant Pending as SendPendingScreen
    participant Failure as SendFailure

    Send->>App: Register timed-out payment hash
    Send->>Pending: Navigate with hash, retry route, BOLT11
    App-->>App: Receive paymentFailed(hash, reason)
    App->>Pending: Publish resolution with failure reason
    Pending->>Failure: Navigate with AppError(reason), retry state, BOLT11
    Failure-->>Failure: Localize reason and determine cache-reset eligibility
    Failure-->>Failure: Prefill support report with BOLT11
Loading

Reviews (1): Last reviewed commit: "fix(send): preserve pending send failure..." | Re-trigger Greptile

@pwltr
pwltr requested a review from jvsena42 August 12, 2026 14:43
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.

1 participant