Commit graph

2017 commits

Author SHA1 Message Date
Slyghtning
d3a2badc8b
loopd: filter unavailable deposits in ListUnspentDeposits
ListUnspentRaw returns the unspent wallet view of the
backing lnd wallet. It might be that deposits show up
there that are actually not spendable because they
already have been used but not yet spent by the server.
We filter out such deposits in ListUnspentDeposits.
2025-08-22 15:54:19 +02:00
András Bánki-Horváth
70cf2d828f
Merge pull request #994 from lightninglabs/dependabot/go_modules/github.com/go-viper/mapstructure/v2-2.4.0
build(deps): bump github.com/go-viper/mapstructure/v2 from 2.3.0 to 2.4.0
2025-08-21 17:26:52 +02:00
dependabot[bot]
7cbf765e11
build(deps): bump github.com/go-viper/mapstructure/v2
Bumps [github.com/go-viper/mapstructure/v2](https://github.com/go-viper/mapstructure) from 2.3.0 to 2.4.0.
- [Release notes](https://github.com/go-viper/mapstructure/releases)
- [Changelog](https://github.com/go-viper/mapstructure/blob/main/CHANGELOG.md)
- [Commits](https://github.com/go-viper/mapstructure/compare/v2.3.0...v2.4.0)

---
updated-dependencies:
- dependency-name: github.com/go-viper/mapstructure/v2
  dependency-version: 2.4.0
  dependency-type: indirect
...

Signed-off-by: dependabot[bot] <support@github.com>
2025-08-21 14:52:54 +00:00
Slyghtning
c1607839e0
Merge pull request #987 from hieblmi/round-weight
fee: round up transaction weight to the nearest satoshi
2025-08-21 10:09:16 +02:00
Slyghtning
1930be8cc7
staticaddr: round up withdrawal tx weight to the nearest satoshi
this commit fixes issue
https://github.com/lightninglabs/loop/issues/966
2025-08-21 09:34:15 +02:00
Slyghtning
7c2f67643d
Merge pull request #991 from hieblmi/cli-show-deposits-and-swaphashes
staticaddr: show deposits and swap hashes in cli
2025-08-20 18:36:07 +02:00
Slyghtning
b2a4d7af2d
staticaddr: show deposits as part of cli swap output 2025-08-20 17:07:29 +02:00
Slyghtning
a41334dd3d
staticaddr: add swap hash to deposit structs 2025-08-20 16:58:20 +02:00
Slyghtning
98fece465d
Merge pull request #993 from hieblmi/asciicheck
gomod: update to Go 1.24.6 and `golangci-lint` v2
2025-08-19 22:26:00 +02:00
Slyghtning
38a44968c7
loopd: atomic var to enforce daemon singelton 2025-08-19 22:08:29 +02:00
Slyghtning
e98f733ef8
linter: fix lint issues after linter v2 update 2025-08-19 21:57:00 +02:00
Slyghtning
bd6271e633
loopd: log correct error if daemon start fails 2025-08-19 21:57:00 +02:00
Slyghtning
cc26813f24
test: fix nil dereference
fixes tests TestLoopOutFailOffchain,
TestLoopOutPaymentParameters
2025-08-19 21:57:00 +02:00
Slyghtning
fe747a0670
linter: migrate .golangci.yml from v1 to v2
Migrated with `golangci-lint migrate --skip-validation`
2025-08-19 21:57:00 +02:00
Slyghtning
37d0be2c5a
go.mod: fix asciicheck mod error 2025-08-19 21:57:00 +02:00
Slyghtning
2ed543b0f9
gomod: upgrade go version and golangci
go is updated to v1.24.6 and golangci
from v1.64.6 to v2.4.0.
2025-08-19 21:56:59 +02:00
Slyghtning
f54d580b73
Merge pull request #990 from hieblmi/deposit-update-index
loopdb: add deposit indices
2025-08-18 13:21:54 +02:00
Slyghtning
e141018da5
loopdb: add deposit indices 2025-08-12 16:36:48 +02:00
András Bánki-Horváth
d7635f3b2a
Merge pull request #989 from lightninglabs/bump-go-version-1.23.12
build: bump Go to v1.23.12
2025-08-07 11:22:19 +02:00
Andras Banki-Horvath
0af425be7b
build: bump Go to v1.23.12 2025-08-07 10:33:09 +02:00
Slyghtning
2f21a488d8
Merge pull request #988 from hieblmi/normalize-deposit-swap
staticaddr: migrate deposit swap hashes
2025-08-01 23:07:04 +02:00
Slyghtning
fe7622db87
staticaddr: fetch deposits as part of swap retrieval
since deposits have been normalized in the db in the
context of a static address swap this commit now
retrieves the deposit information as part of
GetLoopInByHash and GetStaticAddressLoopInSwapsByStates.
2025-08-01 11:26:33 +02:00
Slyghtning
d5e3075d04
loopdb: add query DepositsForSwapHash 2025-08-01 11:26:33 +02:00
Slyghtning
d7ac3148c9
staticaddr: relax scope of ToDeposit 2025-08-01 11:26:33 +02:00
Slyghtning
a1af860527
staticaddr: remove unused fsm transition 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
35901d1247
staticaddr: don't append to public variable PendingStates 2025-08-01 10:34:16 +02:00
András Bánki-Horváth
bbd9813fe0
Merge pull request #968 from lightninglabs/bump-tapd
build: bump tapd
2025-07-31 13:41:29 +02:00
George Tsagkarelis
408e6d75d0
build: bump tapd 2025-07-31 10:56:12 +02:00
Slyghtning
dd85a618ed
Merge pull request #976 from hieblmi/batcher-change-outputs
sweepbatcher: batch change outputs
2025-07-29 22:01:13 +02:00
Slyghtning
d00b78ef6b
sweepbatcher: consolidate identical change pkscripts
batch separate change outputs with identical pkscripts
are tallied up and consolidated to a single change output.
2025-07-29 21:22:17 +02:00
Slyghtning
245a66610b
utils: bip69 output sorting 2025-07-29 18:03:11 +02:00
Slyghtning
340681f233
Merge pull request #959 from hieblmi/deposit-outpoint
staticaddr: method to fetch deposits by outpoints
2025-07-29 16:26:12 +02:00
Slyghtning
e948c94b95
staticaddr: method to fetch deposits by outpoints 2025-07-29 15:52:54 +02:00
Boris Nagaev
54652dc641
sweepbatcher: subtle adjustments for change
- ensurePresigned: use passed minRelayFeeRate instead of chainfee.FeePerKwFloor
 - presign: use minRelayFeeRate for start and minRelayFee
 - presign: make sure minRelayFeeRate is set
 - add tests for presign to test this new behavior; make sure the number of
   transactions is lower if minRelayFeeRate is higher
 - update error message in constructUnsignedTx: use <, not <= (more accurate)
 - use utils.DustLimitForPkScript instead of lnwallet.DustLimitForSize in tests
 - in tests adjust amounts to edge values, add controls
2025-07-29 12:33:56 +02:00
Slyghtning
29348a94df
sweepbatcher: consider min relay fee when constructing batch tx
if constructUnsignedTx constructs a batch transaction that is
below the minimum relay fee, an error is returned.
2025-07-29 12:33:56 +02:00
Slyghtning
bc7d155e69
sweepbatcher: consider change in presigning and batch tx
Presigning sweeps takes change outputs into account.
Each primary deposit id of a sweep group points to
an optional change output.
sweepbatcher.presign scans all passed sweeps for
change outputs and passes them to constructUnsignedTx.
Optional change of a swap is encoded in its sweeps
as a pointer to the same change output. This change
is taken into account when constructing the unsigned
batch transaction when it comes to tx weight and
outputs.
2025-07-29 12:33:55 +02:00
Slyghtning
8399a63091
sweepbatcher: consider optional change in greedy selection 2025-07-29 12:33:55 +02:00
Slyghtning
f30db74756
sweepbatcher: optional change in sweep struct
This commit adds an optional change output to the sweep struct.
2025-07-29 12:33:55 +02:00
Slyghtning
94168c3fe5
utils: function to get dust limit for a pkscript. 2025-07-29 12:33:54 +02:00
Boris Nagaev
bce9b5d45d
Merge pull request #975 from starius/spend-reorgs
sweepbatcher: fix reorg detection
2025-07-24 03:12:42 -03:00
Boris Nagaev
534c71b742
sweepbatcher: minimumSweepFeeRate fixes confTarget
This is already done in GetConfTargetAndFeeRate. The fix is just a double check.
2025-07-24 02:30:15 -03:00
Boris Nagaev
8431784338
sweepbatcher: update feerate outside AddSweep
AddSweep may not be called after getting the first confirmation, but feerate
updates are still needed in case of reorg.

Update test TestFeeRateGrows not to call AddSweep again and make sure feerate
is updated itself.
2025-07-24 02:22:06 -03:00
Boris Nagaev
5c9f6f7d7a
loopout: more logging in sweeping code 2025-07-24 02:22:06 -03:00
Boris Nagaev
957ca21e61
sweepbatcher: fix reorg detection
The reorg channel is now passed to RegisterSpendNtfn, and waiting for spend
notifications remains active even after the transaction receives its first
confirmation. The dedicated goroutine previously used to wait for the spend
is no longer needed, as we now handle both spend and potential reorg events
in the main event loop while the batch is running.

Following this change, RegisterConfirmationsNtfn runs without a reorg channel,
as it would only detect deep reorgs that undo the final confirmation - something
we can't handle anyway. We can't track fully confirmed swaps indefinitely to
guard against such rare reorgs; instead, we can mitigate the risk by increasing
the required confirmation depth.
2025-07-24 02:21:20 -03:00
Boris Nagaev
22d345a534
sweepbatcher: fix flaky test
Since bb837a4aec AddSweep loads sweeps so
one of possible errors is sql.ErrTxDone. Full error that is fixed:
> fetchSweeps failed: failed to load sweep 0000000000000000000101:1:
> failed to fetch sweep data for 010101000000:
> failed to fetch loop out for 010101000000:
> sql: transaction has already been committed or rolled back
2025-07-24 02:19:25 -03:00
Boris Nagaev
36c5d6cee7
test: golang.org/x/net/context -> context 2025-07-24 02:19:25 -03:00
Boris Nagaev
2176e5245e
Merge pull request #978 from starius/static-binaries
make: set CGO_ENABLED=0
2025-07-24 01:37:09 -03:00
Boris Nagaev
b0051382cf
make: set CGO_ENABLED=0
Make loop and loopd binaries static, more portable.
2025-07-24 00:55:10 -03:00
András Bánki-Horváth
6b7158201a
Merge pull request #985 from bhandras/bump-lnd-tapd
build: bump tapd to v0.6.1 and lnd to v0.19.2-beta
2025-07-16 19:36:31 +02:00