Commit graph

129 commits

Author SHA1 Message Date
Gustavo Stingelin
4c03e46928
looprpc: expose static loop-in monitor state 2026-07-21 11:33:46 -03:00
Boris Nagaev
5d8a5019cf
lint: enable deprecation checks
Enable staticcheck's SA1019 check in golangci-lint so deprecated
identifiers are caught in CI.

Replace deprecated standard library and bbolt APIs with their current
equivalents. Keep intentional compatibility reads and writes of
deprecated Loop RPC fields behind narrow nolint annotations, because
older clients and persisted liquidity parameters still depend on those
fields.
2026-06-22 12:46:12 -05:00
Slyghtning
089743dacc
liquidity: fix comment typos 2026-05-27 11:50:08 +02:00
Boris Nagaev
7fcc508193
liquidity: gate static autoloop
Static-address loop-ins in autoloop are still experimental. Reject
loop_in_source=static-address at the RPC boundary unless loopd was started
with --experimental, and pass the same opt-in into the liquidity manager so
persisted params cannot bypass the gate after restart.

The existing static swap accounting remains wired through the manager; the
gate only controls accepting and planning new static-address autoloops.
2026-05-22 02:32:15 -05:00
Boris Nagaev
8ea9adbd35
looprpc: map custom channel reason
Static autoloop testing surfaced a SuggestSwaps failure when the
planner disqualified a custom asset channel.

Add the missing AutoReason enum value and handle ReasonCustomChannelData.
2026-05-22 02:20:36 -05:00
Boris Nagaev
58ebb042ff
liquidity: add static autoloop planner
Wire static-address-backed loop-ins into the existing autoloop
planner and dispatch path. Loop-in rules can now be converted into
static candidates, prepared after global sorting, filtered with
static fee limits, and dispatched through the static manager.

This also fixes MaxAutoInFlight enforcement across all suggested
swap types and adds planner tests for missing static candidates
and mixed in-flight filtering.
2026-05-22 02:20:36 -05:00
Boris Nagaev
e467ac932b
looprpc: expose static autoloop output
Extend the public rpc surface for static autoloop integration
without turning the planner on yet. SuggestSwaps responses can
now carry static-address loop-in requests and the new planner
reason for missing static candidates is mapped over rpc.
2026-05-22 02:20:36 -05:00
Boris Nagaev
7cf0a87c2b
liquidity: count static loop-ins
Teach the liquidity manager to include persisted static loop-ins
in budget accounting, in-flight limits, and peer traffic backoff.
This adds the static fee model used for conservative accounting
and passes storage errors through the relevant planner helpers.

The daemon wiring now exposes static loop-ins to liquidity so the
manager can see the same ongoing swaps that the static-address
subsystem persists, while easy autoloop keeps working with the new
fallible traffic lookup path.
2026-05-22 02:20:36 -05:00
Boris Nagaev
ac58336104
looprpc: add autoloop loop-in source
Add a dedicated loop-in source enum to the liquidity parameters
rpc and wire it through the internal parameter model and CLI.

This keeps the source selection explicit before any static
autoloop planning lands, so operators can choose between the
legacy wallet-funded path and a future static-address-backed
path without relying on implicit fallback behavior.
2026-05-22 02:20:36 -05: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
Slyghtning
afa52aa40d
liquidity: test --excludeeasypeer and --includealleasypeers 2025-11-21 15:38:13 +01:00
Slyghtning
854cac246e
liquidity: exclude peers for easy autoloop 2025-11-21 15:05:52 +01:00
Slyghtning
e98f733ef8
linter: fix lint issues after linter v2 update 2025-08-19 21:57:00 +02:00
Andras Banki-Horvath
693d3a4ca0
liquidity: default to slow swaps for autloop 2025-04-29 18:56:49 +02:00
Oliver Gugger
c70dcc5449
mod+liquidity+test: update to latest lndclient+tapd
Required to build litd with the latest lnd+tapd.
2025-04-25 08:38:03 +02:00
sputn1ck
439d64a08a
liquidity: skip asset channels in easy autoloop 2025-03-25 15:27:54 +01:00
sputn1ck
014e919402
liquidity: add asset loop out unit test 2025-03-25 15:27:54 +01:00
sputn1ck
e7b2836605
liquidity: test move p2wkh to const 2025-03-25 15:27:53 +01:00
sputn1ck
3c79e9d028
liquidity: add easy asset autoloop out 2025-03-25 14:02:09 +01:00
sputn1ck
e3f049ae6f
liquidity: add asset swap info to swap builder 2025-03-25 11:15:41 +01:00
sputn1ck
832a0526d6
liquidity: add easy asset params 2025-03-25 11:15:41 +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
sputn1ck
4dd3074a68
autoloop: ignore asset channels 2025-02-07 10:23:54 +01:00
Boris Nagaev
f8c1607154
loopout, liquidity: turn vars to constants
There are some numeric constants that used to be defined as vars complicating
their usage. They were turned into constants: MinLoopOutPreimageRevealDelta,
DefaultSweepConfTarget, DefaultHtlcConfTarget, DefaultSweepConfTargetDelta.

Also make liquidity.defaultHtlcConfTarget a constant, not a var.
2024-11-11 20:35:35 -03:00
crystalstall
27a234db66 chore: fix some comments for struct field
Signed-off-by: crystalstall <crystalruby@qq.com>
2024-07-19 14:20:07 +08:00
longxiangqiao
273422eef7 chore: fix some comments for struct field
Signed-off-by: longxiangqiao <longxiangqiao@qq.com>
2024-07-13 13:50:12 +08:00
chengehe
0aff202988 chore: make function comments match function names
Signed-off-by: chengehe <hechenge@yeah.net>
2024-06-06 17:39:29 +08:00
Slyghtning
402d9a84df
gomod: bump lnd to version 0.18.0-beta 2024-05-31 09:39:20 +02:00
Boris Nagaev
3be5a37cd3
liquidity: fix flaky autoloop test
This failure became normal recently:

=== RUN   TestAutoLoopInEnabled
    autoloop_testcontext_test.go:318:
        	Error Trace:	/home/runner/work/loop/loop/liquidity/autoloop_testcontext_test.go:318
        	            				/home/runner/work/loop/loop/liquidity/autoloop_test.go:804
        	Error:      	Not equal:
        	            	expected: 80000
        	            	actual  : 160000
        	Test:       	TestAutoLoopInEnabled
    autoloop_testcontext_test.go:318:
        	Error Trace:	/home/runner/work/loop/loop/liquidity/autoloop_testcontext_test.go:318
        	            				/home/runner/work/loop/loop/liquidity/autoloop_test.go:804
        	Error:      	Not equal:
        	            	expected: 160000
        	            	actual  : 80000
        	Test:       	TestAutoLoopInEnabled
    autoloop_testcontext_test.go:343:
        	Error Trace:	/home/runner/work/loop/loop/liquidity/autoloop_testcontext_test.go:343
        	            				/home/runner/work/loop/loop/liquidity/autoloop_test.go:804
        	Error:      	Should be true
        	Test:       	TestAutoLoopInEnabled

The root cause is them the order of items in c.quoteRequestIn depends on the
order of loopInBuilder.buildSwap calls, which depends on the order of channel
handling in Manager.SuggestSwaps, which depends on the order of map traversal,
which is not determitistic.

Since in the test all the amounts are different, I used amount as a key and
put the expected calls into a map using amount as a key. When I extract an
item from c.quoteRequestIn channel, I find the corresponding item in the map
and remove it. All other logic is preserved.
2024-05-30 15:41:51 -03:00
Boris Nagaev
e30cb5f2a8
multi: apply make fmt 2024-04-23 15:18:15 -03:00
George Tsagkarelis
a9be69b281
multi: use isExternalAddr flag 2024-01-23 20:38:07 +02:00
András Bánki-Horváth
7dd30a731e
Merge pull request #644 from bhandras/easy-autoloop-destaddr-fixup
liquidity: dest address support for easy autloop
2023-10-04 14:26:00 +02:00
Andras Banki-Horvath
87c8ca0d8b
liquidity: dest address support for easy autloop 2023-10-04 14:18:37 +02:00
Oliver Gugger
08026dab93
multi: update linter, fix issues 2023-10-03 19:36:40 +02:00
Slyghtning
fd6a9cf3e9
loopin: consider settled invoices success 2023-09-01 13:09:10 +02:00
George Tsagkarelis
e9bc1dcc9e
multi: add initiator to mocked interfaces for tests 2023-07-28 14:43:19 +03:00
George Tsagkarelis
921f4d06e7
multi: integrate initiator string to various calls 2023-07-28 14:43:18 +03:00
Slyghtning
21281e3eb8
liquidity: xpub support for autoloop 2023-07-27 13:51:53 +02:00
Konstantin Nick
0781cafbfb
Merge pull request #585 from sputn1ck/sqlite
Migrate from boltdb to sql
2023-06-20 19:54:37 +02:00
sputn1ck
becc8a38d8
multi: use context in loopdb call
This commit adds a context to our loopdb interface, which we should use
in the sqlite migration.
2023-06-19 12:28:32 +02:00
George Tsagkarelis
afca558817
liquidity: add false-positive checks on autoloop tests 2023-06-14 16:27:46 +03:00
George Tsagkarelis
dbb49cfa05
liquidity: test low feeppm case for easyautoloop 2023-06-14 15:58:44 +03:00
George Tsagkarelis
64d2cbe5d6
liquidity: respect feeppm if set for easyautoloop 2023-06-14 15:53:09 +03:00
George Tsagkarelis
319a519309
Merge pull request #591 from GeorgeTsagk/autoloop-easy-tag
Autoloop easy tag
2023-06-05 17:49:51 +03:00
George Tsagkarelis
dcc28936ce
liquidity: bump miner multiplier in autoloop-in test
After the FeePPM miner fee fix there has probably been a race condition
in this test. The test would expect only one of the two quotes to work,
as one had a marginally high miner fee. After the FeePPM fix that miner
fee was considered valid and we dispatched two swaps instead of one,
with the test setup examining the first one that reached the go channel.
2023-06-02 14:08:10 +03:00
George Tsagkarelis
1f72dcc095
liquidity: use easy autoloop labels 2023-06-02 14:00:58 +03:00
George Tsagkarelis
a48924a664
liquidity: get autoloop flag directly from params
Previously we would exclusively pass the autoloop boolean to multiple
functions while they had directly access to the manager's parameters.
With this commit we remove this explicit flag from the various function
interfaces and retrieve the value directly from the parameters.
2023-05-29 13:24:16 +03:00
George Tsagkarelis
9a9766775a
liquidity: add easy autoloop test 2023-05-22 15:48:38 +03:00