Repository navigation
Spark swaps: payment timeout, no waiting on create, a Transactions tab and slow exits - #640
Merged
Merged
Conversation
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.
…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
marked this pull request as ready for review
October 13, 2026 13:52
Jossec101
enabled auto-merge (squash)
October 13, 2026 14:38
markettes
approved these changes
Oct 14, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
SPARK_PAYMENT_TIMEOUT_MINUTES). A node can set its own in its liquidity settings.REBALANCE_MAX_PARTSis nowSEND_PAYMENT_MAX_PARTS, since swaps use it too. The old name still works.SPARK_EXIT_SPEED(FAST,MEDIUMorSLOW) sets how fast swap exits and Withdraw all confirm on-chain. The default isSLOW, the cheapest.