Skip to content

fix: use spark send key in retry #2019

In progress
In progress

Description

@ovitrif

What happens

A Lightning invoice paid through Spark can be paid twice when the app sends it again after an attempt whose outcome it didn't learn: a crash or kill during the send, a timeout, a relaunch, or a restore before Spark's history synced.

Why

Breez spark-sdk 0.28.3 dedupes send_payment only on its idempotency_key. An invoice with a Spark route hint goes out as a plain Spark transfer with no payment hash, so neither the operators nor fetch_lightning_send_status can tell the invoice was already paid. Two attempts with different keys both pay.

  • Android passes a random key per attempt, and refuses a send while Spark's history can't be read, which also blocks payments that would be safe.
  • iOS passes no key on the BOLT11 send.

Fix

Derive the key from a seed secret, the payment hash and an attempt number, so a retry reuses its attempt's key: the operators return a transfer committed under it instead of sending again. The attempt number moves on only after Spark shows that attempt failed.

Activity

  1. added this to the 3.2.0 milestone on Nov 24, 2026
  2. self-assigned this
    on Nov 24, 2026
  3. changed the title [-]bug: a retried spark invoice can be paid twice[/-] [+]fix: use spark send key in retry[/+] on Nov 25, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions