Commit Graph

1492 Commits (c06b6190af88cde9418dde1e47a816da0f6bdb1c)
 

Author SHA1 Message Date
Alex Bosworth 67ab876879
Merge pull request #768 from lightninglabs/alexbosworth-patch-2
version: bump version to v0.28.3-beta
3 months ago
Alex Bosworth 9b1218a752
version: bump version to v0.28.3-beta 3 months ago
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
3 months ago
Andras Banki-Horvath c7fa1e4109
loopd: run the cost migration on start 3 months ago
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.
3 months ago
Andras Banki-Horvath c650cdc8a8
loopdb: add ability to track manual migrations 3 months ago
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.
3 months ago
Andras Banki-Horvath 08aa4db35d
loopout: correctly account for the prepay amount when calculating costs
Previously we'd not account for the prepay amount which resulted in the
total swap cost reported being lower than what it actually is.
3 months ago
Boris Nagaev 37194d31cf
Merge pull request #761 from starius/sweepbatcher-load-swaps-from-loopdb-only
sweepbatcher/Store: use only own tables (separating from loopdb)
3 months ago
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.
3 months ago
Boris Nagaev 4be69e186e
Revert "sweepbatcher/StoreMock: load LoopOut from loopdb"
This reverts commit d38b7c55a7.

Batcher does not use this data anymore, since previous commit.
3 months ago
Boris Nagaev 16132d1593
sweepbatcher: load swap from loopdb, not own store
Method Store.GetBatchSweeps provides data from tables outside of sweepbatcher:
swaps, loopout_swaps, htlc_keys. It makes it harder to reuse. Batcher already
has a straightforward way to get swap data: LoopOutFetcher interface (loopdb).

In this commit I switch the source of data from the field returned by Store
(LoopOut) to loading independently by calling LoopOutFetcher.FetchLoopOutSwap.
3 months ago
Boris Nagaev c5862898a8
sqlc: remove trailing spaces in queries 3 months ago
Slyghtning 6b09aaaca4
Merge pull request #763 from hieblmi/bump-lnd-0.18.0-beta
gomod: bump lnd to version 0.18.0-beta
3 months ago
Slyghtning 402d9a84df
gomod: bump lnd to version 0.18.0-beta 3 months ago
Boris Nagaev 60c149f885
Merge pull request #762 from starius/fix-flaky-autoloop-test
liquidity: fix flaky autoloop test
3 months ago
Boris Nagaev 3be5a37cd3
liquidity: fix flaky autoloop test
This failure became normal recently:

=== RUN   TestAutoLoopInEnabled
    autoloop_testcontext_test.go:318:
        	Error Trace:	/home/runner/work/loop/loop/liquidity/autoloop_testcontext_test.go:318
        	            				/home/runner/work/loop/loop/liquidity/autoloop_test.go:804
        	Error:      	Not equal:
        	            	expected: 80000
        	            	actual  : 160000
        	Test:       	TestAutoLoopInEnabled
    autoloop_testcontext_test.go:318:
        	Error Trace:	/home/runner/work/loop/loop/liquidity/autoloop_testcontext_test.go:318
        	            				/home/runner/work/loop/loop/liquidity/autoloop_test.go:804
        	Error:      	Not equal:
        	            	expected: 160000
        	            	actual  : 80000
        	Test:       	TestAutoLoopInEnabled
    autoloop_testcontext_test.go:343:
        	Error Trace:	/home/runner/work/loop/loop/liquidity/autoloop_testcontext_test.go:343
        	            				/home/runner/work/loop/loop/liquidity/autoloop_test.go:804
        	Error:      	Should be true
        	Test:       	TestAutoLoopInEnabled

The root cause is them the order of items in c.quoteRequestIn depends on the
order of loopInBuilder.buildSwap calls, which depends on the order of channel
handling in Manager.SuggestSwaps, which depends on the order of map traversal,
which is not determitistic.

Since in the test all the amounts are different, I used amount as a key and
put the expected calls into a map using amount as a key. When I extract an
item from c.quoteRequestIn channel, I find the corresponding item in the map
and remove it. All other logic is preserved.
3 months ago
Boris Nagaev 5c88cf86b9
Merge pull request #760 from starius/sweepbatcher-rm-defaultBatchConfTarget
sweepbatcher: load from DB preserves confTarget
3 months ago
Boris Nagaev 87fb185a9b
sweepbatcher: remove const defaultBatchConfTarget
It is always overwritten with primary sweep's confTarget.

Print a warning if batchConfTarget is 0 in updateRbfRate.

See https://github.com/lightninglabs/loop/pull/754#discussion_r1613514363
3 months ago
Boris Nagaev 40ad1ce609
sweepbatcher: load from DB preserves confTarget
It used to be set to default (defaultBatchConfTarget = 12) which
could in theory affect fee rate if updateRbfRate() and publish()
were not called before the batch was saved. (Unlikely scenario.)
3 months ago
Boris Nagaev d38b7c55a7
sweepbatcher/StoreMock: load LoopOut from loopdb
Method sweepbatcher.Store.FetchBatchSweeps (implementation using real DB) runs
JOIN query to load LoopOut from swaps table. Now the mock does the same.

It is needed to test store and load scenarios in tests.
3 months ago
Boris Nagaev 22dd2e8bd1
Merge pull request #759 from starius/sweepbatcher-avoid-adding-to-two-batches
sweepbatcher: exit early in handleSweep
3 months ago
Boris Nagaev 4258b95dd2
sweepbatcher: fix too long lines 3 months ago
Boris Nagaev 0b2c177445
sweepbatcher: exit early in handleSweep
If the sweep was successfully updated in the batch, no need to
try to add it to all other batches.

Added a test reproducing adding a sweep to both batches without this change.
3 months ago
Boris Nagaev a135eb81f0
Merge pull request #755 from starius/sweepbatcher-changes
sweepbatcher: small refactorings
3 months ago
Boris Nagaev 870b60fada
sweepbatcher: fix docstring 3 months ago
Boris Nagaev 6def712dfe
sweepbatcher: fix typos in annotations of methods 3 months ago
Boris Nagaev dc5d0fe30c
sweepbatcher: narrow down interface of swapStore
Only one method of loopdb.SwapStore is used (FetchLoopOutSwap).
Local interface LoopOutFetcher was defined to reflect this.
3 months ago
Boris Nagaev b5b17991a5
sweepbatcher: use method AddSweep in test 3 months ago
Alex Bosworth 951f98147d
Merge pull request #756 from lightninglabs/update-to-v0.28.2
version: bump version to v0.28.2-beta
3 months ago
Alex Bosworth c44018dc42
version: bump version to v0.28.2-beta 3 months ago
András Bánki-Horváth 563e7be6ae
Merge pull request #754 from bhandras/sweepbatcher-empty-batch-fix
sweepbatcher: do not fail on restoring empty batches
3 months ago
Andras Banki-Horvath 14de8f1f5d
sweepbatcher: test that empty batches won't prevent startup 3 months ago
Andras Banki-Horvath e5ade6a0b1
sweepbatcher: close the quit channel when the batcher is shutting down 3 months ago
Andras Banki-Horvath c01e8014e1
sweepbatcher: do not fail on restoring empty batches
Previously storing an empty batch would make the batcher fail to start
as spinning up a restored batch assumes that there's a primary sweep
added already. As there's no point in spinning up such batch we can just
skip over it.
Furthermore we'll ensure that we won't try to ever publish an empty
batch to avoid setting the fee rate too early.
3 months ago
Andras Banki-Horvath 939c9b4ccf
loopdb+sweepbatcher: add the DropBatch call 3 months ago
Slyghtning 38f0e3a1f5
Merge pull request #753 from hieblmi/static-addr-protocol-version
staticaddr: protocol version package
4 months ago
András Bánki-Horváth e30afba364
Merge pull request #743 from bhandras/loop-out-timeout
loopout: configurable payment timeout for off-chain payments
4 months ago
Andras Banki-Horvath 01c017d913
cli: add payment_timeout option to the CLI as well 4 months ago
Andras Banki-Horvath 0d0af5bf24
loopout: use the request defined payment timeout 4 months ago
Andras Banki-Horvath 4749c029bb
loopdb: add migraton and DB code to handle payment timeout 4 months ago
Andras Banki-Horvath 461ceeeb28
looprpc: add payment_timeout to the LoopOutRequest 4 months ago
András Bánki-Horváth f26a00dd98
Merge pull request #751 from bhandras/negative-fees-fixup
loopout: fix negative reported fees
4 months ago
Andras Banki-Horvath 56902352cd
loopout: fix negative reported fees 4 months ago
Slyghtning 314feb9760
staticaddr: protocol version package 4 months ago
András Bánki-Horváth edbbc3f02f
Merge pull request #752 from bhandras/lnd-18 4 months ago
Andras Banki-Horvath 1ca2542a30
build: bump lnd to v0.18.0-beta.rc3 4 months ago
Andras Banki-Horvath 3b35ddba95
github: bump go version 4 months ago
András Bánki-Horváth 2a3c70fa62
Merge pull request #748 from bhandras/regtest-fixup
regtest: fix loopserver address
4 months ago
Andras Banki-Horvath 7f40042424
regtest: fix loopserver address 4 months ago