Commit graph

325 commits

Author SHA1 Message Date
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
562416e99b
loopd: validate static loop-in labels at rpc
Move static loop-in label validation to the rpc boundary and
remove the same check from the internal manager path.

This keeps external requests aligned with the existing swap rpc
surface while allowing internal autoloop callers to keep using
reserved labels for automated swaps. The tests cover both sides of
that contract: rpc requests still reject reserved labels, and the
manager path accepts them.
2026-05-22 02:20:36 -05:00
0xfandom
8b89f77529 staticaddr: move address.Parameters to script package
The Parameters struct describes the keys, expiry and pkScript that
define the static address script, so its natural home is the script
package. Moving it there lets staticutil drop its dependency on the
address package and lets callers reuse a single type alongside
script.StaticAddress and script.NewStaticAddress.

No behavior change.

Closes #1056
2026-05-01 15:54:37 +05:30
Slyghtning
b702aebbf4
multi: inject clocks into swap lifecycle and update tests
Inject clock.Clock into swapConfig so that swap initiation times
are deterministic and testable. Update all swap tests to use
TestClock with a fixed time, and assert that InitiationTime
matches the clock value.
2026-03-13 08:58:56 +01:00
Slyghtning
a10c741a26
lint: fix linter issues 2026-03-09 14:39:45 +01:00
Slyghtning
0b295123e7
staticaddr: remove dead code across managers
Remove unused errChan fields from the loopin, openchannel, and withdraw
managers. These channels were declared and initialized but never read
from or written to.

Remove the unused activeLoopIns map from the loopin manager. The map
was only written to but never read, making it dead code.

Remove the stale withdraw.Store interface whose method signatures no
longer match the concrete SqlStore API used by the manager.

Remove unused config fields from openchannel.Config (Server,
AddressManager, ChainNotifier, Signer) and deposit.ManagerConfig
(AddressClient, SwapClient, ChainParams) along with their daemon
wiring. Also remove the now-orphaned openchannel.AddressManager
interface.

Remove the unused GetStaticAddress and Close methods from
address.SqlStore and the GetStaticAddress method from the address.Store
interface, as the codebase only uses GetAllStaticAddresses.
2026-03-09 14:39:44 +01:00
Slyghtning
a9977dd5f4
godoc: address copy-paste errors accross the codebase 2026-03-09 14:39:44 +01:00
Slyghtning
b74dab8af4
loopd: instantiate static address open channel manager 2026-02-26 20:57:27 +01:00
Slyghtning
f47b611557
looprpc: extend client.proto with lnrpc.OutPoint and lnrpc.OpenChannelRequest
In this commit we import the lnd's lightning.proto into client.proto to
then be able to use lnrpc.OutPoint and lnrpc.OpenChannelRequest instead
of the looprpc.OutPoint type.
This is safe because the lnrpc and looprpc versions of OutPoint are the
same type.
2026-02-26 09:37:26 +01:00
Boris Nagaev
59140265ca
loopd: implement SweepHtlc RPC 2026-01-29 17:40:58 -05:00
Boris Nagaev
d1c4a7da8a
loopd: test error reporting logic 2025-12-20 06:31:02 +01:00
Slyghtning
f4e7e676d4
loopd: fix errors.Is argument order 2025-12-19 10:18:09 +01:00
Boris Nagaev
a4dc59099b
cli: add command "loop stop"
* add StopDaemon RPC with permissions + REST binding
* expose `loop stop` CLI (with optional --wait) and wait logic
* pass daemon shutdown callback + unit test and regenerate docs/protos
2025-11-19 23:42:48 -03:00
Boris Nagaev
6d480cfd9e
staticaddr: require positive heights at startup
Loop now guards all static-address managers against zero block heights: each
constructor returns an error when invoked with a non-positive current height,
and `loopd` validates the height from `GetInfo` before instantiating them.
Tests and helper code were updated accordingly so we fail fast instead of
registering chain notifications with invalid hints.
2025-11-16 01:24:01 -03:00
Boris Nagaev
bde49d7a91
loopd: wait for chain notifier
Use https://github.com/lightninglabs/lndclient/pull/255
2025-11-16 00:26:02 -03:00
András Bánki-Horváth
0a182ee308
Merge pull request #1029 from bhandras/resume-stuck-swaps
loop: add resume manager
2025-10-31 15:01:28 +01:00
Boris Nagaev
325441bf47
loopd: fix crash in instant if no --experimental
Previously the daemon crashed with a panic. Now the CLI returns the following
message:

[loop] rpc error: code = Unimplemented desc = Restart loop with --experimental
2025-10-31 01:36:22 -03:00
Andras Banki-Horvath
460fc116d8
loop: add resume manager 2025-10-30 22:41:00 +01:00
Slyghtning
de2964efba
loopd: refactor blocks-until-expiry calculation 2025-10-09 09:14:43 +02:00
Slyghtning
0d3a4c8a19
loopd: more info in StaticAddressLoopInResponse 2025-10-08 21:34:48 +02:00
Slyghtning
68baebf478
loopd: return quoted amount in InQuoteResponse 2025-10-07 11:13:44 +02:00
Slyghtning
168420c28d
loopd: fast-flag in GetLoopInQuote and StaticAddressLoopIn 2025-10-07 09:12:38 +02:00
Slyghtning
55081cd8fe
staticaddr: ignoreUnknown flag for DepositsForOutpoints 2025-09-26 12:03:48 +02:00
Slyghtning
2ee772b251
staticaddr: selected swap amount migration
The selected_amount column of all previous
swaps is filled with the total value of
deposits that partook in these swaps.
2025-09-25 11:13:35 +02:00
Slyghtning
23f6c24c0c
staticaddr: fix swap amount in listswaps command 2025-09-25 11:13:34 +02:00
Slyghtning
95a456791b
loopd: deposit selection for GetLoopInQuote
If a quote request contains an amount and flag
SelectDeposits set to true the quoting coin-
selects the required deposits to meet the
swap amount in order to quote for the number
of deposits.
2025-09-25 11:13:34 +02:00
Slyghtning
a862f8ba60
test: unit test ListUnspentDeposits 2025-08-22 16:18:15 +02:00
Slyghtning
d3a2badc8b
loopd: filter unavailable deposits in ListUnspentDeposits
ListUnspentRaw returns the unspent wallet view of the
backing lnd wallet. It might be that deposits show up
there that are actually not spendable because they
already have been used but not yet spent by the server.
We filter out such deposits in ListUnspentDeposits.
2025-08-22 15:54:19 +02:00
Slyghtning
b2a4d7af2d
staticaddr: show deposits as part of cli swap output 2025-08-20 17:07:29 +02:00
Slyghtning
a41334dd3d
staticaddr: add swap hash to deposit structs 2025-08-20 16:58:20 +02:00
Slyghtning
38a44968c7
loopd: atomic var to enforce daemon singelton 2025-08-19 22:08:29 +02:00
Slyghtning
bd6271e633
loopd: log correct error if daemon start fails 2025-08-19 21:57:00 +02:00
Slyghtning
6e7441ba8d
staticaddr: migrate swap hashes to deposits 2025-08-01 11:26:32 +02:00
Boris Nagaev
fab4a646df
Merge pull request #967 from starius/neutrino-fixes
staticaddr: neutrino fixes
2025-06-25 13:41:50 -03:00
Andras Banki-Horvath
d12dc0362d
loopd: avoid panic if asset client is not set 2025-06-24 14:55:42 +02:00
Boris Nagaev
6f50b27b7d
loopd: increase withdrawal manager start timeout
This is needed for neutrino.
2025-06-24 01:44:32 -03:00
Boris Nagaev
1036214160
sweepbatcher: add an option to ignore HTLC txids
Added option WithSkippedTxns, which has one historical problematic tx by default.
Sweeps originating from these transactions are omitted when reading from DB.

loopdb: add column sweep_batches.cancelled and replaced DropBatch with
CancelBatch. It is needed, because sweep.batch_id is a foreign key to batch.

Changed StoreMock.InsertSweepBatch not to reuse batch_id. This is needed by
the test, which checks that new batch has fresh ID.
2025-06-17 14:47:49 -03:00
Slyghtning
13247c4651
staticaddr: wait for address manager initiation 2025-06-13 15:37:38 +02:00
Slyghtning
614d61937e
loopd: retrieve historic withdrawal info 2025-06-10 17:07:32 +02:00
Viktor Tigerström
cdcacfe753
multi: update GetInfoResponse response
Update the output of the `commit_hash` field in the GetInfoResponse.
The `commit_hash` field will contain the most recent commit_hash that
the build was based on. If the build had uncommitted changes, this field
will contain the most recent commit hash, suffixed by "-dirty".

Note that this change also changes the output of `commit` field in the
`--version` command. The `Commit` field will now contain most recent git
commit tag.
2025-05-22 18:01:36 +02:00
Slyghtning
cf0651af38
staticaddr: add expiry to NewAddress response 2025-05-15 14:56:49 +02:00
sputn1ck
1ce9bdd0d3
multi: use reservation ids in instant out quote 2025-04-30 15:35:25 +02:00
ffranr
64e6bbd451
perms: move perms.go into looprpc
The Lightning Node Connect (LNC) WASM client currently imports both
`looprpc` and the entire `loop` module to access `perms.go`. This
creates problems because `loop` imports `taproot-assets`, resulting in
too many symbols for the WASM build.

To fix this, we will move `perms.go`—which defines RPC endpoint
permissions—into `looprpc`. After this change, the LNC WASM client will
import only `looprpc`, while the rest of `loop` can continue importing
`taproot-assets` without affecting the LNC WASM build.
2025-04-28 12:56:21 -03:00
Boris Nagaev
6d3f65a0f2
looprpc: rename field in WithdrawDepositsResponse
It returns an address, but the field was called pk_script, which was confusing.
Also renamed it in the code.
2025-04-24 11:19:59 -03:00
Sam Korn
5cc119b610
looprpc: add test for ListSwaps pagination and filtering 2025-04-19 22:31:45 -06:00
Sam Korn
b55521cb41
looprpc: add simple pagination to the ListSwaps command
This commit adds the ability to set a max_swaps and an index_offset
flag to the ListSwaps command. These new fields are applied AFTER
the initial filtering step. The response also now passes additional
information about the index count and total swaps filtered.
2025-04-19 22:31:45 -06:00
Andras Banki-Horvath
9a6266f9f7
loop: add the commit_hash to GetInfoResponse, change version semantics
With this commit we extend GetinfoResponse with the strict commit hash
(which also includes whether the build tree was clean or dirty).
2025-04-04 12:47:30 +02:00
sputn1ck
6e49e3710c
loopd: add asset client to autoloop cfg 2025-03-25 15:27:53 +01: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