2
0
mirror of https://github.com/lightninglabs/loop synced 2024-11-09 19:10:47 +00:00
Commit Graph

1541 Commits

Author SHA1 Message Date
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
dependabot[bot]
fa3b9b3a96
build(deps): bump github.com/docker/docker
Bumps [github.com/docker/docker](https://github.com/docker/docker) from 24.0.9+incompatible to 25.0.6+incompatible.
- [Release notes](https://github.com/docker/docker/releases)
- [Commits](https://github.com/docker/docker/compare/v24.0.9...v25.0.6)

---
updated-dependencies:
- dependency-name: github.com/docker/docker
  dependency-type: indirect
...

Signed-off-by: dependabot[bot] <support@github.com>
2024-08-12 12:29:18 -03:00
Boris Nagaev
7cfee83912
Merge pull request #804 from starius/fix-AddSuccessToEstimator
swap: fix leaf estimation in AddSuccessToEstimator
2024-08-12 12:28:41 -03:00
Boris Nagaev
fa8703f052
swap: fix leaf estimation in AddSuccessToEstimator
According to AddTapscriptInput's godoc, the first argument (leafWitnessSize)
must include not the whole size of witness, but only the size of data consumed
by the revealed script. Previously the value was too high, because it also
included the following extra elements: number_of_witness_elements (1 byte),
witness script and its size, control block and its size.

Tests for greedy_batch_selection were affected by this change.
2024-08-12 12:18:36 -03:00
András Bánki-Horváth
a5180ffcd3
Merge pull request #808 from drawdrop/master
chore: fix some function names
2024-08-12 17:05:52 +02:00
drawdrop
b4193dfb28 chore: fix some function names
Signed-off-by: drawdrop <cricis@icloud.com>
2024-08-12 22:59:32 +08:00
András Bánki-Horváth
44d46010a0
Merge pull request #807 from lightninglabs/alexbosworth-patch-5 2024-08-08 21:11:44 +02:00
Alex Bosworth
c367598869
version: bump version to v0.28.7-beta 2024-08-08 11:02:11 -07:00
Boris Nagaev
0c8d12a75e
Merge pull request #806 from starius/client-last-hop
client: fill LastHop in FetchSwaps
2024-08-08 10:08:40 -03:00
Boris Nagaev
ed3db3bab2
client: fill LastHop in FetchSwaps
Loop used to "forget" last_hop of swaps created before its restart.
The commit fixes this.

Added test TestFetchSwapsLastHop for this. Filled field abandonChans in test
utility function newSwapClient because the field is used in new test.

Fixes https://github.com/lightninglabs/loop/issues/798
2024-08-08 10:00:36 -03:00
Boris Nagaev
8c97c60bb4
Merge pull request #803 from starius/loop-cli-path-opts-fix
cmd/loop: fix path options and loopDir interaction
2024-08-05 10:44:19 -03:00
Boris Nagaev
dd57e8fb4e
cmd/loop: fix path options and loopDir interaction
According to the comment in the code, loopdir should affect tls cert path and
macaroon path only if custom values were not set for them. However the actual
code ignored custom tls cert path and macaroon path if loopdir and/or network
was changed. For instance, the following call:

loop --network regtest --tlscertpath tls.cert --macaroonpath loop.macaroon

resulted in using ~/.loop/regtest/tls.cert and ~/.loop/regtest/loop.macaroon
instead of the files provided.

This commit fixes the code to match the description in the comment.
Also the comment was updated to mention custom network setting in addition
to custom loopdir.
2024-08-05 00:37:41 -03:00
András Bánki-Horváth
d8361e3105
Merge pull request #795 from yingshanghuangqiao/master
chore: fix some comments
2024-07-22 10:59:13 +02:00
yingshanghuangqiao
57ebc3ff16 chore: fix some comments
Signed-off-by: yingshanghuangqiao <yingshanghuangqiao@foxmail.com>
2024-07-22 16:11:16 +08:00
András Bánki-Horváth
70b0af1452
Merge pull request #794 from crystalstall/master
chore: fix some comments for struct field
2024-07-19 08:36:47 +02: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
Boris Nagaev
4c490398e4
Merge pull request #787 from starius/sweepbatcher-greedy-batch-selection
sweepbatcher: add greedy batch selection algorithm
2024-07-18 14:19:03 -03:00
Boris Nagaev
7a61d5e743
loopout_test: enable logging in sweepbatcher 2024-07-18 13:38:57 -03:00
Boris Nagaev
026cf0d47a
sweepbatcher: always try greedy batch selection
Now that sweep.minFeeRate is always set, greedy batch selection has all needed
inputs to work even without customFeeRate provider.
2024-07-18 13:38:57 -03:00
Boris Nagaev
75641c3573
sweepbatcher: always fill sweep.minFeeRate
Use customFeeRate if it is provided, otherwise use wallet's EstimateFeeRate.

Added flag SkipNextBump to rbfCache to avoid extra bumping upon updating
fee rate externally.

Fix test TestSweepBatcherCloseDuringAdding, it didn't have confTarget and
failed in wallet.EstimateFeeRate call.
2024-07-18 13:38:57 -03:00
Boris Nagaev
5dac7ca75b
sweep: fix godoc of GetSweepFeeDetails 2024-07-18 13:38:57 -03:00
Boris Nagaev
f5e97c035d
sweepbatcher: log batcher failures
This is useful to debug. It used to fail silently.
2024-07-18 13:38:57 -03:00
Boris Nagaev
db5e0d1d27
sweepbatcher: fix inaccuracies in fee estimations
Use SigHashDefault instead of SigHashAll in weight estimations.
Actual code uses SigHashDefault, not SigHashAll. SigHashAll is 1wu larger.

Use the actual destination address in weight estimator, not taproot always.
In the test the type of address is P2WPKH, not taproot.

Updated testSweepFetcher to calculate fee, fee rate and weight accurately and
to compare the data observed in the published transaction with the estimates.
2024-07-18 13:38:57 -03:00
Boris Nagaev
44d9147175
sweepbatcher: add greedy batch selection algorithm
If custom fee rates are used, the algorithm is tried. It selects a batch for the
sweep using the greedy algorithm, which minimizes costs, and adds the sweep to
the batch. If it fails, old algorithm is used, trying to add to any batch, or
starting a new batch.
2024-07-18 13:38:57 -03:00
Boris Nagaev
019d3c613f
sweep: factor out function AddOutputEstimate
It adds output to transaction weight estimator depending on address type.
2024-07-18 13:38:57 -03:00
Boris Nagaev
e8141578ac
sweepbatcher: MinFeeRate -> WithCustomFeeRate
The reason is because we want to know in advance if fee rates come from
an external source or are determined by sweepbatcher internally.

Also remove WithNoBumping option. It is now a part of WithCustomFeeRate:
if WithCustomFeeRate is passed, automatic fee bumping by sweepbatcher
is disabled.
2024-07-18 13:38:57 -03:00
Boris Nagaev
ccd1b312ca
sweepbatcher: fix copy-paste with batch kit 2024-07-18 13:38:57 -03:00
Boris Nagaev
1f1a27447c
sweepbatcher: fix copy-paste with batchConfig 2024-07-18 13:38:57 -03:00
Boris Nagaev
1290ebe535
sweepbatcher: fix copy-paste in sweep creation 2024-07-18 13:38:57 -03:00
Slyghtning
e8384be227
Merge pull request #793 from hieblmi/instantout-fixes
instantout: assign chaincfg in sql store
2024-07-16 20:26:01 +02:00
Slyghtning
9af205de09
instantout: assign chaincfg in sql store 2024-07-16 19:41:51 +02:00
Slyghtning
424ed2c000
Merge pull request #792 from longxiangqiao/master
chore: fix some comments for struct field
2024-07-14 20:22:49 +02: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
András Bánki-Horváth
b48059482d
Merge pull request #790 from lightninglabs/alexbosworth-patch-4 2024-07-11 23:18:02 +02:00
Alex Bosworth
3f9b61fa55
version: bump version to v0.28.6-beta 2024-07-11 13:20:46 -07:00
András Bánki-Horváth
e75ebaee86
Merge pull request #789 from bhandras/sweep-batcher-db-parent-batch-fixup
sweepbatcher: fix spawning condition "unattached" spend notifiers
2024-07-11 15:24:34 +02: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
2024791e15
Merge pull request #784 from starius/sweepbatcher-custom-musig2
sweepbatcher: add option WithCustomSignMuSig2
2024-06-28 13:33:36 -03:00
Boris Nagaev
c06b6190af
sweepbatcher/test: test tx is signed and published
Also fix the tests that used to fail to sign and broadcast transactions.
2024-06-28 13:13:45 -03:00