Skip to content

Spark swaps: payment timeout, no waiting on create, a Transactions tab and slow exits - #640

Merged
Jossec101 merged 6 commits into
mainfrom
spark/payments-and-transfers
Oct 14, 2026
Merged

Jossec101 merged 6 commits into
mainfrom
spark/payments-and-transfers

Conversation

@Jossec101

@Jossec101 Jossec101 commented Oct 13, 2026 •

Copy link
Copy Markdown
Contributor
  • Payment timeout. You can now set how long a Spark swap's payment keeps trying, in minutes. The default is 10, from 1 to 25 (SPARK_PAYMENT_TIMEOUT_MINUTES). A node can set its own in its liquidity settings.
  • No waiting. Creating a Spark swap no longer waits for the payment. The dialog closes, the payment runs in the background, and the swap shows as pending on the Swaps page.
  • Payment parts. REBALANCE_MAX_PARTS is now SEND_PAYMENT_MAX_PARTS, since swaps use it too. The old name still works.
  • Transactions tab. A Spark wallet's details now list its transfers: date, direction, type, amount, status and swap. Web page only.
  • Exit speed. SPARK_EXIT_SPEED (FAST, MEDIUM or SLOW) sets how fast swap exits and Withdraw all confirm on-chain. The default is SLOW, the cheapest.

A Spark swap's payment had a fixed 2-minute LND timeout. It is now SPARK_PAYMENT_TIMEOUT_MINUTES (10 by
default, 1 to 25 so LND gives up well before the 30-minute invoice expires), and each node can set its own
in its liquidity settings. MPP splitting stays the rebalances' one, whose setting is renamed
SEND_PAYMENT_MAX_PARTS as every SendPaymentV2 call uses it (REBALANCE_MAX_PARTS is still read).
With a payment timeout of minutes, creating a Spark swap would block the New Swap dialog and RequestSwapOut
until LND gave up. The swap is now recorded and returned pending, and its payment runs in the background
(SparkPaymentLauncher, in a scope of its own) and saves its outcome: the routing fee once paid, the failure
once it definitely failed. An unknown outcome, or NodeGuard restarting mid-payment, is left to
MonitorSwapsJob, which finds the payment by its hash. The dialog closes onto the Swaps page.
…ype and swap

The details of a Spark wallet get a Transactions tab: the wallet's latest transfers, newest first, with their
date, direction, type (a Lightning payment in, an exit to on-chain, a Spark transfer), amount, status and the
swap each belongs to (the one it paid in, or whose leaves it exited).
Takes Elenpay/nspark 0a70341: every withdrawal takes an ExitSpeed (FAST by default, so nothing changes yet).
…s that wait for slow exits

SPARK_EXIT_SPEED (FAST, MEDIUM or SLOW; SLOW, the cheapest, by default) sets the speed of every swap exit and of Withdraw all. An exit's leaves stay the wallet's until it confirms, so a swap whose exit was sent still accounts for them until it completes, and the overdue alert waits 6, 12 or 24 hours with the speed. The New Swap confirmation and the Withdraw all dialog state the speed.
@Jossec101 Jossec101 changed the title spark/payments and transfers Spark swaps: payment timeout, no waiting on create, a Transactions tab and slow exits Oct 13, 2026
…er service

Nothing the payment uses is disposed when the request that created the swap ends (the swap repository opens a context per call; SendPaymentV2Async only uses the singleton router), so SparkSwapService fires it itself with Task.Run. The swap is read again once the payment ends, so a swap the monitor resolved meanwhile isn't overwritten; an error is logged and left to the monitor.
@Jossec101
Jossec101 marked this pull request as ready for review October 13, 2026 13:52
@Jossec101
Jossec101 enabled auto-merge (squash) October 13, 2026 14:38
Comment thread src/Data/Models/Node.cs Resolved
@Jossec101
Jossec101 disabled auto-merge October 14, 2026 09:25
@Jossec101
Jossec101 merged commit 3baa5d1 into main Oct 14, 2026
11 checks passed
@Jossec101
Jossec101 deleted the spark/payments-and-transfers branch October 14, 2026 09:25
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants