Commit graph

138 commits

Author SHA1 Message Date
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
11bf5ca219
loopdb: clean up comments 2026-05-27 11:50:30 +02: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
360af61005
loopdb: test error handling for bbolt.Open 2025-12-19 14:17:16 -03:00
Slyghtning
f4e7e676d4
loopd: fix errors.Is argument order 2025-12-19 10:18:09 +01:00
Slyghtning
92a8726e07
loopdb: staticaddr fast flag migration and queries 2025-10-07 08:53:36 +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
22ac716726
sqlc: add amount column to static swaps 2025-09-25 11:13:33 +02:00
Slyghtning
e98f733ef8
linter: fix lint issues after linter v2 update 2025-08-19 21:57:00 +02:00
Slyghtning
e141018da5
loopdb: add deposit indices 2025-08-12 16:36:48 +02:00
Slyghtning
d5e3075d04
loopdb: add query DepositsForSwapHash 2025-08-01 11:26:33 +02:00
Slyghtning
6e7441ba8d
staticaddr: migrate swap hashes to deposits 2025-08-01 11:26:32 +02:00
Slyghtning
e948c94b95
staticaddr: method to fetch deposits by outpoints 2025-07-29 15:52:54 +02:00
Boris Nagaev
1794aa21e5
loopdb: remove unused method ConfirmBatch 2025-06-26 14:01:16 -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
94aeae81ed
loopdb: withdrawal table and queries 2025-06-03 12:57:10 +02:00
sputn1ck
56848d0cfa
reservation: add protocol version 2025-04-30 14:23:47 +02:00
Boris Nagaev
38b7ecdb9d
loopdb: fix migration 13 for Postgres
Don't copy values of ID column from sweeps to sweeps2 and let it auto-assign
values there. This is needed for the sequencer for that column to be up-to-date
with the values.
2025-04-04 16:31:57 -03:00
Boris Nagaev
c80ebb96e9
sweepbatcher: allow swap_hash to be non-unique
SwapHash used to be a key in the sweeps table. Now the key is outpoint which
replaces columns outpoint_txid and outpoint_index. In-memory structures and unit
tests were also updated to use outpoint as key. Outpoint is truly unique.
2025-04-01 11:11:44 -03:00
Boris Nagaev
2249c41d2f
loopdb: switch to go.etcd.io/bbolt
github.com/coreos/bbolt has race conditions:
https://github.com/golang/go/issues/54690
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
sputn1ck
40614a2a7a
loopdb: add asset params to store 2025-01-21 18:26:20 +01:00
sputn1ck
1440b6bb1d
loopout: add asset loop out payment flow 2025-01-21 18:26:19 +01:00
Slyghtning
fc6c9f224c
staticaddr: add initiation height of address 2024-12-12 18:31:10 +01:00
Slyghtning
494d0915b0
sqlc: loop-in tables and queries
We add CRU procedures for static address swaps.
2024-12-12 18:31:06 +01:00
Slyghtning
55f7625bc5
sqlc: withdrawal address for deposits
Deposit schema extension with a withdrawal
sweep address. If the user selects a deposit
for withdrawal the destination address of the
sweep is stored here.
2024-12-12 18:31:04 +01:00
Slyghtning
5f4fca8219
sqlc: deposit queries, models and migrations 2024-12-12 18:31:03 +01:00
Slyghtning
ca2ecac3d1
loopdb: static address store 2024-12-12 18:31:01 +01:00
Slyghtning
2c07434a72
sqlc: static address migrations, models, queries 2024-12-12 18:31:00 +01: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
Andras Banki-Horvath
bd5418337c
loopdb: properly lock store mock for concurrent access 2024-09-02 13:35:38 +02:00
drawdrop
b4193dfb28 chore: fix some function names
Signed-off-by: drawdrop <cricis@icloud.com>
2024-08-12 22:59:32 +08:00
Andras Banki-Horvath
6a4ef3683a
sweepbatcher: fix spawning condition "unattached" spend notifiers
Previously, when handling a sweep we assumed that if a sweep status
was completed, the parent batch was also finished. However, since the
batch confirmation status depends on three on-chain confirmations, it
is possible that a spend notifier was started for a sweep of an active
batch. The notifier would fetch the parent batch from the database, but
because we incorrectly assumed that  the parent was confirmed (when it
was not), the DB call would fail with a 'no rows returned' error.
This failure would cause the sweep to fail and the sweep batcher to
stop, resulting in a permanent failure state.
2024-07-11 13:15:39 +02:00
Boris Nagaev
d6aa4fe8a9
loopdb: all BaseDB's methods use receiver name db 2024-06-20 11:58:46 -03:00
Boris Nagaev
4c2d874b8d
loopdb: use passed transaction in ExecTx calls
Some calls used external queries instead of the passed one,
bypassing the transaction.
2024-06-19 10:38:55 -03: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
d341448568
loopdb: fix description of BaseDB.ExecTx 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
jinjingroad
12bc3b2e9e chore: fix some comments
Signed-off-by: jinjingroad <jinjingroad@sina.com>
2024-06-05 15:12:47 +08:00
András Bánki-Horváth
55241ffe04
Merge pull request #764 from bhandras/costs-cleanup-migration
loop: add migration to fix stored loop out costs
2024-06-03 16:04:30 +02:00
Andras Banki-Horvath
f40ef193e9
loop: add migration for loopout swaps to fix negative stored costs
Previously we may have stored negative costs for some loop out swaps
which this commit attempts to correct by fetching all completed swap,
calculating the correct costs and overriding them in the database.
2024-06-03 14:54:18 +02:00
Andras Banki-Horvath
c650cdc8a8
loopdb: add ability to track manual migrations 2024-06-03 14:54:18 +02:00
Andras Banki-Horvath
4f5c806ba5
loopdb: add helper methods to update swap costs
This commit adds the necessary sqlc code and SwapStore function to
update swap costs for all swaps in one transaction.
2024-06-03 14:54:18 +02:00
Boris Nagaev
7a7ea05e52
sweepbatcher/Store: do not provide LoopOut field
This data is not used by Batcher since commit
"sweepbatcher: load swap from loopdb, not own store".

Now sweepbatcher.Store depends only on tables sweeps and sweep_batches
and does not depend on swaps, loopout_swaps and htlc_keys, making it
easier to reuse.
2024-05-31 12:28:02 -03:00
Boris Nagaev
c5862898a8
sqlc: remove trailing spaces in queries 2024-05-31 12:28:02 -03:00
Andras Banki-Horvath
939c9b4ccf
loopdb+sweepbatcher: add the DropBatch call 2024-05-24 18:44:04 +02:00
Andras Banki-Horvath
4749c029bb
loopdb: add migraton and DB code to handle payment timeout 2024-05-23 17:17:21 +02:00
Boris Nagaev
e30cb5f2a8
multi: apply make fmt 2024-04-23 15:18:15 -03:00