Commit graph

1579 commits

Author SHA1 Message Date
sputn1ck
5df53cd81a
notifications: add notification manager
This commit adds a generic notification manager
that can be used to subscribe to different types
of notifications.
2024-10-08 14:58:41 +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
András Bánki-Horváth
61c0b45897
Merge pull request #829 from bhandras/cost-migration-rpc-batchsize
loopd: allow setting RPC batch size when running cost migration
2024-10-08 14:55:31 +02:00
Konstantin Nick
5be132290a
Merge pull request #830 from sputn1ck/rpc_ntfn_stream
swapserverrpc: refactor reservation notifications
2024-10-07 12:04:50 +02:00
sputn1ck
cc1d942c7a
swapserverrpc: refactor reservation notifications
This commit refactors the proto definitions of the
reservation notifications to use a more generic
mechanism that can be used for other types of
notifications as well.
2024-10-07 11:57:31 +02:00
Boris Nagaev
96d321ece7
Merge pull request #825 from starius/swapserverrpc-looprpc
multi: do not rename swapserverrpc to looprpc
2024-09-25 12:42:10 -03:00
Boris Nagaev
af81f3b2bf
swapserverrpc: sync with server types 2024-09-22 13:31:03 -03:00
Andras Banki-Horvath
0e2a36004a
loopd: allow setting RPC batch size when running cost migration
Previously we defaulted to fetching 1000 payments at a time when running
the cost migration however due to slowness on LND side this may prevent
the migration from completing due to RPC timeout kicking in. This commit
adds a new config value to give more control to the user by setting the
batch size as needed.
2024-09-20 10:13:48 +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
András Bánki-Horváth
6db2a39331
Merge pull request #816 from lightninglabs/dependabot/go_modules/github.com/jackc/pgx/v5-5.5.4
build(deps): bump github.com/jackc/pgx/v5 from 5.3.1 to 5.5.4
2024-09-03 18:20:56 +02:00
András Bánki-Horváth
35d27fa0e2
Merge pull request #821 from bhandras/support-incomplete-mocks 2024-09-02 19:25:55 +02:00
Andras Banki-Horvath
a55c461a8f
test: support incomplete mocks
Updating the mocks to be complete implementation of the underlying
interfaces is not always possible due to cross dependency issues.
This commit embeds the interfaces into the mocks so we can at least
always compile them.
2024-09-02 18:49:22 +02:00
dependabot[bot]
d160112610
build(deps): bump github.com/jackc/pgx/v5 from 5.3.1 to 5.6.0
Bumps [github.com/jackc/pgx/v5](https://github.com/jackc/pgx) from 5.3.1 to 5.6.0.
- [Changelog](https://github.com/jackc/pgx/blob/master/CHANGELOG.md)
- [Commits](https://github.com/jackc/pgx/compare/v5.3.1...v5.6.0)

---
updated-dependencies:
- dependency-name: github.com/jackc/pgx/v5
  dependency-type: indirect
...

The commit was updated by Boris to bump the version to 5.6.0.
2024-09-02 12:30:57 -03:00
Slyghtning
64b0e24419
Merge pull request #818 from hieblmi/in-batch-logging
sweepbatcher: log confirmed batch tx id
2024-09-02 16:00:53 +02:00
Slyghtning
3ee3963030
sweepbatcher: log confirmed batch tx id 2024-09-02 15:42:51 +02:00
András Bánki-Horváth
634fbbcba2
Merge pull request #819 from bhandras/store-mock-mx
loopdb: properly lock store mock for concurrent access
2024-09-02 14:23:41 +02:00
Andras Banki-Horvath
bd5418337c
loopdb: properly lock store mock for concurrent access 2024-09-02 13:35:38 +02:00
Boris Nagaev
8978afede9
Merge pull request #817 from starius/fix-typo
sweepbatcher: fix typo in log message
2024-09-01 22:07:26 -03:00
Boris Nagaev
dba3d15b02
sweepbatcher: fix typo in log message 2024-09-01 13:00:36 -03:00
Boris Nagaev
9751780fae
Merge pull request #815 from starius/publish-errors-handler
sweepbatcher: add option WithPublishErrorHandler
2024-08-28 13:12:38 -03:00
Boris Nagaev
7c93dff830
sweepbatcher: add option WithPublishErrorHandler
WithPublishErrorHandler sets the callback used to handle publish errors.
It can be used to filter out noisy messages.
2024-08-27 19:26:29 -03:00
Boris Nagaev
6b852c1c0b
go.mod: update btcwallet
Update it to the version having symbol chain.ErrInsufficientFee.
2024-08-27 19:26:29 -03:00
Boris Nagaev
54bf02294e
go.mod: update lnd to v0.18.3-beta.rc1
This is needed to update btcwallet dependency.
2024-08-27 19:26:29 -03:00
Boris Nagaev
898efbf2ae
sweepbatcher: fix godoc 2024-08-27 10:57:41 -03:00
Boris Nagaev
876ed401db
Merge pull request #813 from starius/sweepbatcher-max-inputs
sweepbatcher: set max batch size to 1000 sweeps
2024-08-27 10:03:36 -03:00
Boris Nagaev
7780aca492
sweepbatcher: log the reason of acceptance failure
Add Info log message in cases when addSweep returns accept=false and err=nil.
2024-08-26 20:53:29 -03:00
Boris Nagaev
f21a21ee41
sweepbatcher: set max batch size to 1000 sweeps
This is needed to avoid non-standard batch transactions (larger than 400k wu).
A non-cooperative input is 393 wu, so 1000 inputs are still under 400k wu.
2024-08-26 14:17:24 -03:00
Boris Nagaev
a6e9a2b652
Merge pull request #791 from starius/sweepbatcher-mixed-batches
sweepbatcher: add mixed batches as an option
2024-08-21 14:11:24 -03:00
Boris Nagaev
b171f76b27
sweepbatcher: make greedy algo mixed batch aware 2024-08-21 14:05:50 -03:00
Boris Nagaev
d007cf6e20
sweepbatcher: use coopFailed in greedy selection
Treat coopFailed flag the same as nonCoopHint. The former is what we found in
previos signing attempts, the later is what the caller signalled to us.
2024-08-21 14:05:50 -03:00
Boris Nagaev
26eda00ef2
sweepbatcher: add mixed batches option
Option WithMixedBatch instructs sweepbatcher to create mixed batches with regard
to cooperativeness. Such a batch can include both sweeps signed both
cooperatively and non-cooperatively. If cooperative signing fails for a sweep,
transaction is updated to sign that sweep non-cooperatively and another round of
cooperative signing runs on the remaining sweeps. The remaining sweeps are
signed in non-cooperative (more expensive) way. If the whole procedure fails for
whatever reason, the batch is signed non-cooperatively (the fallback).
2024-08-21 14:05:50 -03:00
Boris Nagaev
58d9445bc5
test/signer_mock: return signatures of real size
Size of a signature affects the weight of transaction, which is verified
in tests.

Also method SignOutputRaw now returns the number of signatures matching
the number of signature descriptors to prevent crashes in tests where
multiple inputs are signed.
2024-08-21 14:05:50 -03:00
Boris Nagaev
2c2c427a6d
sweepbatcher: factor out method createPsbt
Unload method publishBatchCoop. Also this code will be reused in new method
for mixed batches soon.
2024-08-21 14:05:50 -03:00
Boris Nagaev
5cd6c0c83c
sweepbatcher: coopSignBatchTx accepts wire.MsgTx
... instead of psbt.Packet.

Make the code simpler. Function worked with packet.UnsignedTx only,
so it is easier to pass tx directly.
2024-08-21 14:05:50 -03:00
András Bánki-Horváth
ff144c7e25
Merge pull request #812 from bhandras/use-looprpc-tag
build: use tagged looprpc v1.0.0
2024-08-21 17:44:51 +02:00
Andras Banki-Horvath
dbc56ff8c9
build: use tagged looprpc v1.0.0 2024-08-21 17:36:09 +02:00
András Bánki-Horváth
b76163ffcb
Merge pull request #811 from bhandras/looprpc-mod
looprpc: Convert looprpc into a Versioned Module
2024-08-21 17:30:53 +02:00
Andras Banki-Horvath
64886dfc66
looprpc: convert looprpc into a versioned module
This commit transforms the looprpc subpackage into a versioned module.
By doing so, projects that rely solely on the generated RPC code from
the proto files will benefit from significantly reduced dependencies
during compilation.
2024-08-21 16:46:33 +02:00
Boris Nagaev
07791664c6
Merge pull request #809 from starius/sweepbatcher-tx-label
sweepbatcher: customize transaction labels
2024-08-13 10:46:20 -03:00
Boris Nagaev
7fb7c2bda1
sweepbatcher: customize transaction labels
Previously sweepbatcher used loop/labels.LoopOutBatchSweepSuccess to assign
transactions labels. The value is "BatchOutSweepSuccess -- $batch_id", which
does not fit use cases outside of loop-out. Now there is option WithTxLabeler
which sets a function used to generate the label.
2024-08-13 10:42:00 -03:00
Boris Nagaev
98fa740375
Merge pull request #801 from starius/sweepbatcher-wait
sweepbatcher: add options WithInitialDelay and WithPublishDelay
2024-08-13 10:34:32 -03:00
Boris Nagaev
9af6718089
sweepbatcher: test InitialDelay and PublishDelay
Tested scenarios:

1. For a regular sweep newly added it waits for initialDelay + publishDelay
   before publishing a transaction.
2. For a sweep recovered from DB it does not wait before publishing tx.
3. If a sweep is about to expire, initialDelay is skipped.
2024-08-13 10:28:11 -03:00
Boris Nagaev
3f56345492
sweepbatcher: add option WithPublishDelay
WithPublishDelay sets the delay of batch publishing that is applied in the
beginning, after the appearance of a new block in the network or after the
end of initial delay (see WithInitialDelay). It is needed to prevent
unnecessary transaction publishments when a spend is detected on that block.
Default value depends on the network: 5 seconds in mainnet, 0.5s in testnet.
For batches recovered from DB this value is always 0s.
2024-08-13 09:20:31 -03:00
Boris Nagaev
e178d32717
sweepbatcher: add option WithInitialDelay
WithInitialDelay instructs sweepbatcher to wait for the duration provided
after new batch creation before it is first published. This facilitates
better grouping. It only affects newly created batches, not batches loaded from
DB, so publishing does happen in case of a daemon restart (especially important
in case of a crashloop). Defaults to 0s. If a sweep is about to expire (time
until timeout is less that 2x initialDelay), then waiting is skipped.
2024-08-13 09:20:31 -03:00
Boris Nagaev
429eb85e14
sweepbatcher: use lnd/clock for timers
Added option: WithClock. Use it for publishDelay timer.
It will be used for testing.
2024-08-13 09:20:31 -03:00
Boris Nagaev
d7fa4ab94d
test.Guard: make timeout configurable 2024-08-13 09:20:31 -03:00
Boris Nagaev
be69653bf0
sweepbatcher/store: remove unused field clock 2024-08-13 09:20:31 -03:00
Boris Nagaev
ce4a4d97a5
sweepbatcher: rename a private const
Renamed defaultPublishDelay to defaultTestnetPublishDelay. Its godoc was already
for defaultTestnetPublishDelay, but the const was named defaultPublishDelay.
2024-08-13 09:20:31 -03:00
Boris Nagaev
6d3a488f2f
Merge pull request #802 from lightninglabs/dependabot/go_modules/github.com/docker/docker-25.0.6incompatible
build(deps): bump github.com/docker/docker and cli from 24.0.9+incompatible to 27.1.1+incompatible
2024-08-12 12:44:06 -03:00
Boris Nagaev
1aec52c719
go.mod: update docker and cli to 27.1.1
Fix build in https://github.com/lightninglabs/loop/pull/802
2024-08-12 12:29:18 -03:00