Commit graph

65 commits

Author SHA1 Message Date
Slyghtning
e772f8ccfa
instantout: enforce the accepted swap fee
Carry the accepted quote into each request, persist it, and reject
invoices above that limit. Preserve compatibility for requests that
omit the cap while distinguishing an explicit zero.
2026-08-11 21:27:35 +02:00
Slyghtning
b596eabab3
instantout: recheck reservation timing during recovery
Refresh the chain height when a swap resumes, verify both the
reservation and HTLC windows, and select the HTLC path when either
remaining window is too short.
2026-08-11 21:27:35 +02:00
Slyghtning
b689e361c1
instantout: close unfinished MuSig2 sessions
Clean up abandoned signing sessions on error paths while leaving
completed sessions to lnd.
2026-08-11 21:27:35 +02:00
Slyghtning
6853e69a05
instantout: verify finalized MuSig2 witnesses
Run script validation for every combined signature before accepting a
finalized transaction, surfacing invalid witnesses immediately.
2026-08-11 21:27:35 +02:00
Slyghtning
b3776e92f4
instantout: validate MuSig2 response dimensions
Check nonce, signature, session, and transaction input counts before
indexing signing vectors, returning clear errors for incomplete data.
2026-08-11 21:27:34 +02:00
Slyghtning
51eb8f410a
reservation: validate confirmed output amounts
Compare each confirmed transaction output with the expected reservation
amount before advancing the state machine.
2026-08-11 21:27:34 +02:00
Slyghtning
c75d7e3e81
reservation: bound and prune active state machines
Limit newly accepted reservation state machines, resume all persisted
reservations, remove terminal entries from memory, and make cleanup
resilient to observer-driven eviction.
2026-08-11 21:27:34 +02:00
Slyghtning
41b884f610
reservation: reject duplicate reservation entries
Check active and persisted reservations before creating a new state
machine, preserving the existing reservation when a duplicate arrives.
2026-08-11 21:21:53 +02:00
Slyghtning
2989ceee42
reservation: isolate asynchronous initialization errors
Use a goroutine-local result for event dispatch so observer errors
remain independent and initialization outcomes stay deterministic.
2026-08-11 21:21:53 +02:00
Slyghtning
806c1f9356
reservation: keep processing after notification errors
Log individual reservation initialization failures and continue
consuming later notifications instead of stopping the manager.
2026-08-11 21:21:53 +02:00
Gustavo Stingelin
2e80b92cf9 build: rename reservation FSM diagram 2026-07-20 12:08:22 -03:00
Gustavo Stingelin
e77a1ab634 fsm: harden diagram generation 2026-07-20 12:07:26 -03:00
Gustavo Stingelin
1d5b1c564a fsm: make diagram generation deterministic 2026-07-18 16:27:11 -03:00
Slyghtning
a10c741a26
lint: fix linter issues 2026-03-09 14:39:45 +01:00
Slyghtning
a9977dd5f4
godoc: address copy-paste errors accross the codebase 2026-03-09 14:39:44 +01:00
Boris Nagaev
0b53296aa8
multi: factor out sweep fee clamping function 2026-01-15 03:06:22 -05:00
Boris Nagaev
edbef4987a
reservation: fix log line
Previously the log was corrupted:
confirmed in tx: &{2 [0xc000e802a0] [0xc00087fb80 0xc00087fba0] 205}
2025-12-21 12:53:40 -03:00
Slyghtning
e98f733ef8
linter: fix lint issues after linter v2 update 2025-08-19 21:57:00 +02:00
Andras Banki-Horvath
31f996cb37
build: bump tapd to v0.6.1 and lnd to v0.19.2-beta 2025-07-16 19:05:32 +02:00
sputn1ck
1ce9bdd0d3
multi: use reservation ids in instant out quote 2025-04-30 15:35:25 +02:00
sputn1ck
56848d0cfa
reservation: add protocol version 2025-04-30 14:23:47 +02:00
Boris Nagaev
dc4a5641ac
multi: initialize block height in New, not in Run
If Run sets the current height field, it is technically a race between Run and
other methods reading the field. Setting in New is a safer option.

Removed a check that height is not 0 from static address manager.
2025-03-19 15:00:31 +01:00
Boris Nagaev
ce77fcc12c
instantout/reservation: fix data race in test 2025-03-19 15:00:30 +01:00
Oliver Gugger
65251e8821
multi: update linter, fix issues 2025-03-10 22:59:50 +01:00
Oliver Gugger
722ad8839d
multi: update lnd compile-time dependency to v0.19.0 2025-03-10 22:59:49 +01:00
Konstantin Nick
78fafbaeb4
Merge pull request #839 from sputn1ck/fsm_ctx
FSM: add ctx to SendEvent and Actions
2024-10-22 16:49:45 +02:00
sputn1ck
f2fb722901
reservation: add initchan
This fixes a flake in the unit tests
2024-10-22 11:46:31 +02:00
sputn1ck
246becb10a
instantout: update package to use new fsm context
This commit updates the instantout package to use the new fsm context
instead of the old fsm context. This is only a first step in the process
of migrating the instantout package to the new fsm context. The next
step should be to remove the stored context in the instantout manager.
2024-10-22 11:46:31 +02:00
sputn1ck
44306275f7
reservation: update package to use new fsm context
This commit updates the reservation package to use the new fsm context
instead of the old fsm context. This is only a first step in the process
of migrating the reservation package to the new fsm context. The next
step should be to remove the stored context in the reservation manager.
2024-10-22 11:46:30 +02:00
Oliver Gugger
93525d3edf
multi: bump lnd compile time dependency to v0.18.4-beta 2024-10-22 09:12:31 +02:00
sputn1ck
d6c7237b77
reservations: check if channel is closing
This commit adds a check to the runtime loop
of the reservation manager to check if the
channel is closing before trying to read
from it.
2024-10-15 20:26:05 +02:00
sputn1ck
6408ec8e7e
reservation: remove notifications from reservation
This commit removes the notification stream from
the reservation manager and replaces it with a
subscriber interface.
2024-10-08 14:58:37 +02:00
Boris Nagaev
8447f58ff9
multi: do not rename swapserverrpc to looprpc
Many imports renamed it, but it was not needed.
2024-09-10 09:54:17 -03:00
Slyghtning
9af205de09
instantout: assign chaincfg in sql store 2024-07-16 19:41:51 +02:00
Boris Nagaev
1947b90842
multi: typed callback in ExecTx
Provide a wrapped store type, exposing ExecTx method with a subset
interface in the callback argument. BaseDB interfaces in instantout,
reservation and sweepbatcher use ExecTx with their subset Querier
instead of whole sqlc.Querier (*sqlc.Queries).

This is needed to make the packages more reusable, so they don't
depend on methods of *sqlc.Queries they don't use.
2024-06-19 10:38:55 -03:00
Boris Nagaev
2847e83fcf
multi: separate Querier from BaseDB interfaces
A Querier holds the methods of sqlc.Querier interface relevant for a package.
BaseDB has Querier + ExecTx method.

This change is needed to simplify further rework of ExecTx.
2024-06-19 10:38:55 -03:00
Boris Nagaev
8d8cd9129f
reservation: add missing BaseDB interface method
Method InsertReservationUpdate was missing in the interface.
2024-06-19 10:38:55 -03:00
Boris Nagaev
91507d8633
reservation: fix description of UpdateReservation
The description was from another method (InsertReservationUpdate).
2024-06-19 10:38:55 -03:00
Boris Nagaev
3fd3fab8d1
loopdb: provide function NewSqlWriteOpts
It returns transaction options resulting in full (read+write) tx.

Use it in loopdb and instantout stores.
2024-06-17 12:26:37 -03:00
Slyghtning
402d9a84df
gomod: bump lnd to version 0.18.0-beta 2024-05-31 09:39:20 +02:00
Boris Nagaev
0e7927ac96
multi: replace LSAT with L402
git mv ./cmd/loop/lsat.go ./cmd/loop/l402.go
sed 's@lsat@l402@g' -i `git grep -l lsat`
sed 's@Lsat@L402@g' -i `git grep -l Lsat`
sed 's@LSAT@L402@g' -i `git grep -l LSAT`
make rpc

Updated release_notes.md.
2024-04-24 13:28:28 -03:00
Boris Nagaev
e30cb5f2a8
multi: apply make fmt 2024-04-23 15:18:15 -03:00
sputn1ck
b3805b7cad
instantout: add listinstantout func 2024-03-04 12:25:55 +01:00
sputn1ck
f3919d976c
instantout: export value and expiry 2024-03-04 12:25:52 +01:00
sputn1ck
6a62be0d09
instantout: add addr to send funds to 2024-03-04 09:43:52 +01:00
sputn1ck
1be6d39677
instantout: log correct expiry 2024-03-03 11:49:31 +01:00
Konstantin Nick
6a62cd02d7
Merge pull request #698 from sputn1ck/io_reservation_expiry 2024-02-12 12:33:05 +01:00
sputn1ck
a7ab998a3b
instantout: check reservation expiry 2024-02-12 12:28:56 +01:00
Andras Banki-Horvath
7fb75c2f83
instantout: fix swapserverrpc dependent compilation 2024-02-09 20:36:12 +01:00
sputn1ck
7578349220
reservation: fix exiting on fetchL402
This commit changes the way the reservation
manager works, by not exiting when the fetchL402
call fails. This ensures that a client can still
run loop, even if they don't have outbound
capacity or the loop server is offline.
2024-02-09 15:23:53 +01:00