loop/instantout
Slyghtning 10512bfa19
instantout: unlock reservations on OnRecover from in-flight states
SendPaymentAndPollAccepted and BuildHtlc both run after
PollPaymentAcceptedAction has called LockReservation on every
reservation backing the swap. Their OnRecover transitions pointed
directly to Failed, whose action is fsm.NoOpAction -- so on daemon
restart while in either state, the FSM moved to Failed without ever
unlocking the reservations. The local store kept them in the Locked
state until on-chain expiry (typically tens of hours later), making
them unusable for any subsequent swap. For users who pay for
reservations (PR #883's invoice-requested flow) that is a direct
material loss.

Add an intermediate UnlockReservationsOnRecover state whose action
calls handleErrorAndUnlockReservations and then routes to Failed via
the normal OnError edge. SendPaymentAndPollAccepted.OnRecover and
BuildHtlc.OnRecover now point at this state instead of Failed
directly.

Init.OnRecover -> Failed is left alone because at that point the
InstantOut row has not yet been persisted and no reservation locks
have been taken; there is nothing to clean up. Post-PushPreimage
states (PushPreimage.OnRecover -> PushPreimage, etc.) are also left
alone since they self-loop on recovery rather than terminate.

The cleanup helper itself still derives its context from the caller's
context (see existing handleErrorAndUnlockReservations); fixing that
context-cancel hazard is a separate change.
2026-08-11 15:02:44 +02:00
..
reservation instantout/reservation: extend RPC state wait timeout 2026-08-11 15:02:44 +02:00
actions.go instantout: unlock reservations on OnRecover from in-flight states 2026-08-11 15:02:44 +02:00
fsm.go instantout: unlock reservations on OnRecover from in-flight states 2026-08-11 15:02:44 +02:00
fsm.md fsm: make diagram generation deterministic 2026-07-18 16:27:11 -03:00
instantout.go instantout: enforce the accepted swap fee 2026-08-11 12:16:08 +02:00
instantout_test.go instantout: enforce the accepted swap fee 2026-08-11 12:16:08 +02:00
interfaces.go instantout: add fsm and actions 2024-02-06 15:07:57 +01:00
log.go multi: update lnd compile-time dependency to v0.19.0 2025-03-10 22:59:49 +01:00
manager.go multi: require Loop Out permission for Instant Out 2026-08-11 15:02:42 +02:00
store.go instantout: enforce the accepted swap fee 2026-08-11 12:16:08 +02:00
store_test.go instantout: add instantout store 2024-02-06 15:07:57 +01:00