Skip to content

bug: refused spark send reads liveness before the record mark #1908

Closed

Description

@ovitrif

Description

LightningRepo.settledSparkSendOutcome reads isSendLive before sparkRepo.sendRecordMark(). earlierLightningSend and earlierNodeSend read the mark first.

A competing Spark send can be admitted, enter sendsInFlight and record its send between those two statements. If it then finishes during the lightningSend row read, the post-read checks see nothing live, and an older FAILED row turns the refused send into SendRefused while the competing send paid.

The window is two adjacent non-suspending statements, and the competing send has to finish inside the row read.

Fix

Read the mark first:

val sparkRecordsBefore = sparkRepo.sendRecordMark()
val wasLive = isSendLive(paymentHash, key, ldkRecordsBefore)

Found by @coreyphillips in #1903 (comment).

Activity

  1. added this to the 3.2.0 milestone on Nov 12, 2026
  2. ovitrif commented on Nov 12, 2026

    @ovitrif
    CollaboratorAuthor

    Milestone 3.2.0: this issue is a bug in Spark sends, a follow-up to #1900, and Spark sends ship in 3.2.0.

  3. self-assigned this
    on Nov 14, 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