Skip to content

Auto-liquidity fills a provider's free slots each run; max swap routing fee per provider - #644

Merged
Jossec101 merged 2 commits into
mainfrom
liquidity/parallel-swaps
Oct 16, 2026
Merged

Jossec101 merged 2 commits into
mainfrom
liquidity/parallel-swaps

Conversation

@Jossec101

@Jossec101 Jossec101 commented Oct 16, 2026 •

Copy link
Copy Markdown
Contributor
  • Several swaps per auto-liquidity run. A run used to start one swap per node, so a provider's max swaps in flight was rarely reached: a Spark swap set to 5 still ran one at a time. Now a run starts as many swaps as the picked provider has free slots (its max swaps in flight minus its swaps in flight).
    • Each swap is as big as the provider allows, within what's left of the node's excess balance and, for Spark, of its wallet's room.
    • Beyond the first swap, another is added only while the run's worst-case routing fees (each swap's max routing fee) fit the swap fee budget left.
    • If a swap can't be created, the run stops and keeps the ones it started.
    • This applies to every provider. A node whose Loop max swaps in flight is above 1 will now start several Loop swaps per run.
  • Max swap routing fee per provider. Loop, 40swap and Spark each have their own, set on the Nodes page next to the provider's other limits, and shown in the grid. For Spark it includes Spark's own 0.15%.
    • Auto-liquidity uses the picked provider's. So does RequestSwapOut when the caller doesn't give one.
    • The migration (AddPerProviderSwapRoutingFee) turns the node's current value into Loop's and copies it to 40swap's and Spark's, so nothing changes until you edit them.
  • Tests. Unit tests for filling free slots, the slots already used, Spark's room, the excess balance, the budget cap, Loop swaps each getting their own address and routing fee, and a failed swap ending the run. The Spark E2E now starts five swaps at once with a Spark max swaps in flight of 5: all are accepted, paid in parallel by alice's LND, and exit together. No E2E drives auto-liquidity itself, but it creates swaps through the same path.

…ng fee per provider

An auto-liquidity run now starts as many swaps as the picked provider has free slots (its max swaps in flight less its swaps in flight), each the most it takes within what is left of the excess balance and, for Spark, of its wallet's room. Beyond the first, a swap is added only while the run's worst-case routing fees fit the swap fee budget left; a swap that can't be created ends the run. Max swap routing fee becomes per provider (Loop, 40swap, Spark), used by auto-liquidity and RequestSwapOut's default; the migration renames the shared value to Loop's and copies it to the others.
…ight

The batched-exit E2E now starts five swaps at once with alice's Spark max swaps in flight at 5, instead of two: all are accepted, alice's LND pays the five invoices in parallel, and all are paid and exit together.
@Jossec101
Jossec101 requested a review from markettes October 16, 2026 16:05
@Jossec101
Jossec101 marked this pull request as ready for review October 16, 2026 16:05
@Jossec101
Jossec101 enabled auto-merge (squash) October 16, 2026 16:07
@Jossec101
Jossec101 disabled auto-merge October 16, 2026 16:19
@Jossec101
Jossec101 merged commit 20b4329 into main Oct 16, 2026
6 of 11 checks passed
@Jossec101
Jossec101 deleted the liquidity/parallel-swaps branch October 16, 2026 16:19
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