Commit Graph

1553 Commits (bd5418337c81af9691b4f85e988e2649cabbc2ed)
 

Author SHA1 Message Date
Andras Banki-Horvath bd5418337c
loopdb: properly lock store mock for concurrent access 3 weeks ago
Boris Nagaev a6e9a2b652
Merge pull request #791 from starius/sweepbatcher-mixed-batches
sweepbatcher: add mixed batches as an option
4 weeks ago
Boris Nagaev b171f76b27
sweepbatcher: make greedy algo mixed batch aware 4 weeks ago
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.
4 weeks ago
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).
4 weeks ago
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.
4 weeks ago
Boris Nagaev 2c2c427a6d
sweepbatcher: factor out method createPsbt
Unload method publishBatchCoop. Also this code will be reused in new method
for mixed batches soon.
4 weeks ago
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.
4 weeks ago
András Bánki-Horváth ff144c7e25
Merge pull request #812 from bhandras/use-looprpc-tag
build: use tagged looprpc v1.0.0
4 weeks ago
Andras Banki-Horvath dbc56ff8c9
build: use tagged looprpc v1.0.0 4 weeks ago
András Bánki-Horváth b76163ffcb
Merge pull request #811 from bhandras/looprpc-mod
looprpc: Convert looprpc into a Versioned Module
4 weeks ago
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.
4 weeks ago
Boris Nagaev 07791664c6
Merge pull request #809 from starius/sweepbatcher-tx-label
sweepbatcher: customize transaction labels
1 month ago
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.
1 month ago
Boris Nagaev 98fa740375
Merge pull request #801 from starius/sweepbatcher-wait
sweepbatcher: add options WithInitialDelay and WithPublishDelay
1 month ago
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.
1 month ago
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.
1 month ago
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.
1 month ago
Boris Nagaev 429eb85e14
sweepbatcher: use lnd/clock for timers
Added option: WithClock. Use it for publishDelay timer.
It will be used for testing.
1 month ago
Boris Nagaev d7fa4ab94d
test.Guard: make timeout configurable 1 month ago
Boris Nagaev be69653bf0
sweepbatcher/store: remove unused field clock 1 month ago
Boris Nagaev ce4a4d97a5
sweepbatcher: rename a private const
Renamed defaultPublishDelay to defaultTestnetPublishDelay. Its godoc was already
for defaultTestnetPublishDelay, but the const was named defaultPublishDelay.
1 month ago
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
1 month ago
Boris Nagaev 1aec52c719
go.mod: update docker and cli to 27.1.1
Fix build in https://github.com/lightninglabs/loop/pull/802
1 month ago
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>
1 month ago
Boris Nagaev 7cfee83912
Merge pull request #804 from starius/fix-AddSuccessToEstimator
swap: fix leaf estimation in AddSuccessToEstimator
1 month ago
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.
1 month ago
András Bánki-Horváth a5180ffcd3
Merge pull request #808 from drawdrop/master
chore: fix some function names
1 month ago
drawdrop b4193dfb28 chore: fix some function names
Signed-off-by: drawdrop <cricis@icloud.com>
1 month ago
András Bánki-Horváth 44d46010a0
Merge pull request #807 from lightninglabs/alexbosworth-patch-5 1 month ago
Alex Bosworth c367598869
version: bump version to v0.28.7-beta 1 month ago
Boris Nagaev 0c8d12a75e
Merge pull request #806 from starius/client-last-hop
client: fill LastHop in FetchSwaps
1 month ago
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
1 month ago
Boris Nagaev 8c97c60bb4
Merge pull request #803 from starius/loop-cli-path-opts-fix
cmd/loop: fix path options and loopDir interaction
2 months ago
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.
2 months ago
András Bánki-Horváth d8361e3105
Merge pull request #795 from yingshanghuangqiao/master
chore: fix some comments
2 months ago
yingshanghuangqiao 57ebc3ff16 chore: fix some comments
Signed-off-by: yingshanghuangqiao <yingshanghuangqiao@foxmail.com>
2 months ago
András Bánki-Horváth 70b0af1452
Merge pull request #794 from crystalstall/master
chore: fix some comments for struct field
2 months ago
crystalstall 27a234db66 chore: fix some comments for struct field
Signed-off-by: crystalstall <crystalruby@qq.com>
2 months ago
Boris Nagaev 4c490398e4
Merge pull request #787 from starius/sweepbatcher-greedy-batch-selection
sweepbatcher: add greedy batch selection algorithm
2 months ago
Boris Nagaev 7a61d5e743
loopout_test: enable logging in sweepbatcher 2 months ago
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.
2 months ago
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.
2 months ago
Boris Nagaev 5dac7ca75b
sweep: fix godoc of GetSweepFeeDetails 2 months ago
Boris Nagaev f5e97c035d
sweepbatcher: log batcher failures
This is useful to debug. It used to fail silently.
2 months ago
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.
2 months ago
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.
2 months ago
Boris Nagaev 019d3c613f
sweep: factor out function AddOutputEstimate
It adds output to transaction weight estimator depending on address type.
2 months ago
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.
2 months ago
Boris Nagaev ccd1b312ca
sweepbatcher: fix copy-paste with batch kit 2 months ago