Skip to content

bug: spark send shows failed at expiry, then pays #1463

Backlog

Description

@ovitrif

A Spark Lightning send whose sendPayment call errored after the operators committed it can be reported as failed at its invoice's expiry, then settle as paid later. QuickPay and Paykit accounting for it is released by the failure.

Both apps end such a hold once the invoice expired and a sync past expiry reached Spark (lastSyncedAt after the expiry, no lastSyncError), and Spark's list shows no attempt of the send:

  • bitkit-ios: LightningService.railSyncedSinceUncertainSend
  • bitkit-android: SparkRepo.trySettleUncertainSend

Cause

In spark-sdk 0.28.3:

  • send_payment writes the send's payment row only after the SSP call returns Ok (crates/breez-sdk/core/src/sdk/lightning_sender.rs, pay_and_persist_lightning_invoice and payment_from_pay_result). When it errors, only a pending-send cache entry is kept.
  • The row then appears through resume_pending_sends, which logs and swallows its errors, or through the payment-history import (sync_wallet_state_to_storage).
  • last_synced_at is set when spark_wallet.sync() succeeds, whatever the import's result (crates/breez-sdk/core/src/sdk/sync.rs, sync_wallet_internal). last_sync_error also reflects only the wallet sync, and the public Synced event carries no per-step result.

So a sync whose wallet step succeeded but whose resume and import failed advances lastSyncedAt, while the send still has no row. The apps can't tell that sync apart from a complete one.

Fix

This needs a signal from the SDK: the payment-history import's result in getInfo or the Synced event, or last_synced_at set only when the import succeeded. Once one exists, both apps end the hold only after a sync whose import succeeded.

The window is one sync past the invoice's expiry in which the wallet sync succeeds and the import fails.

Found in review of #1415.

Activity

  1. added theissue type on Nov 26, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions