Skip to content

[Bug]: LN activity keeps failed attempt amount after successful retry (same invoice) #1042

Description

@piotr-iohk

What happened?

After a failed Lightning send (e.g. 300,000 sats, ROUTE_NOT_FOUND), the activity correctly shows Failed with that amount.

Retrying to the same address / invoice (same payment hash) with a different amount succeeds, but the activity updates to Sent while still showing the first (failed) amount (e.g. 300k instead of the amount that actually went out).

Logs from repro session show one payment hash 3b8b626f…:

  • 09:16:17 — initiated send 300,000 sats → PaymentFailed (ROUTE_NOT_FOUND)
  • 09:16:33 — same hash → PaymentSuccessful at 22 sats (22000 msat)

Screen recording of the UI symptom to be attached.

Expected behavior

One activity row per payment hash (LDK model). After a failed attempt and a successful retry on the same invoice, the activity should reflect the final succeeded payment: correct Sent status and actual amount (and fee / preimage), matching iOS behavior.

Showing both failed and succeeded rows for the same payment hash would double-count mentally; overwrite with correct final fields is preferred.

Steps to Reproduce

  1. Regtest (or staging) wallet with spending balance and an open channel.
  2. Send a Lightning payment large enough to fail routing (e.g. 300,000 sats to a reachable but under-capacity peer, or force ROUTE_NOT_FOUND).
  3. Confirm activity shows Failed with that amount.
  4. Retry to the same Lightning Address / invoice flow (same payment hash — typical for amountless invoices or “send again” to same LNURL).
  5. Enter a smaller amount that succeeds.
  6. Open Activity → payment shows Sent but amount is still the failed attempt amount.

Logs / Screenshots / Recordings

  • Logs zip (attach manually): logs.zip
    • Key lines: PaymentFailed then PaymentSuccessful for hash 3b8b626f8cdc85e5a4dea06c4431137a1d357ee434e43051cacbfff2639743c2 (300k fail → 22 sats success)
  • Screen recording:
Screen.Recording.2026-06-24.at.11.17.53.mov

Bitkit Version

2.3.0 (182)

Device / OS

Pixel 6 emulator (Pixel_6 AVD), Android 13 (API 33)

Reproducibility

Often (>50%) — depends on provoking a failed outbound payment then retrying same invoice with different amount; confirmed in one logged session.

Additional context

  • Environment: Regtest / local docker stack
  • Similar issues: #790 (max send failures) — different symptom; no duplicate found for activity amount on retry.
  • iOS note: iOS rebuilds full LightningActivity from payment.amountSats on each sync (CoreService.processLightningPayment). Android only updates status / updatedAt / contact on existing rows in processBolt11 - Android-only display bug.
  • Root cause (code review): CoreService.processBolt11 — when updating existing Activity.Lightning, copy() updates status but not value, fee, preimage, or message. New activities set value = payment.amountSats; updates do not.
  • Suggested fix: On update, refresh value, fee, preimage, message from PaymentDetails like iOS processLightningPayment.
  • Related file: app/src/main/java/to/bitkit/services/CoreService.kt (processBolt11, ~521–526)

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No fields configured for Bug.

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions