Repository navigation
Commit 45a2463
Persist splice intents until the splice locks
LDK only persists a splice once its negotiation reaches
AwaitingSignatures, so a splice in flight when the node stops can leave
no trace in LDK. Persist each user-initiated splice as an intent record
before its contribution is handed to LDK, so such a splice can be
recognized at the next startup — releasing whatever the wallet still
holds for it, which a later commit adds — and so events about the
splice can be described in terms of the original request.
A fee bump reuses the channel's existing intent record, so at most one
record ever exists per channel. The record is undone when LDK rejects
the hand-off synchronously and settled once the splice locks, its
failure is surfaced, or its channel closes. A failure event settles the
intent only after the event is durably queued — a crash in between
leaves the intent for the replayed event to settle, erring toward a
duplicate report over a lost one — and only when the event's
contribution identifies the recorded splice: a mismatch means the
failure concerns an older, superseded attempt with no record of its
own. A splice queued behind another pending splice survives the pending
splice's lock, so its intent is re-anchored to the new funding rather
than settled.
Wallet state staged on a splice's behalf is flushed only after the
intent record persists, so nothing the wallet reserves for a splice can
outlive the record through which a later startup would release it. A
splice that fails before the hand-off releases what the wallet holds
for it immediately; one LDK rejects has it returned through the
DiscardFunding event instead. When a lock settles an intent without
spending its inputs — a replacement or counterparty-initiated splice
locked instead — the inputs are released for other spends.
Once a splice funding payment is classified, the intent is carried on
the payment's record until the splice locks; a payment that already
graduated instead removes the leftover intent record.
Developed with assistance from Claude Code.
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>1 parent 50bbfe1 commit 45a2463
7 files changed
Lines changed: 1092 additions & 45 deletions
File tree
- src
- channel
- payment
- wallet
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
53 | 53 | | |
54 | 54 | | |
55 | 55 | | |
| 56 | + | |
56 | 57 | | |
57 | 58 | | |
58 | 59 | | |
| |||
2451 | 2452 | | |
2452 | 2453 | | |
2453 | 2454 | | |
| 2455 | + | |
| 2456 | + | |
| 2457 | + | |
| 2458 | + | |
| 2459 | + | |
| 2460 | + | |
| 2461 | + | |
| 2462 | + | |
2454 | 2463 | | |
2455 | 2464 | | |
2456 | 2465 | | |
| |||
2490 | 2499 | | |
2491 | 2500 | | |
2492 | 2501 | | |
| 2502 | + | |
2493 | 2503 | | |
2494 | 2504 | | |
2495 | 2505 | | |
| |||
0 commit comments