Commit Graph

15321 Commits

Author SHA1 Message Date
Olaoluwa Osuntokun
8405590152
lnrpc/signrpc+lnwallet/rpcwallet: expose local nonces over RPC
In this commit, we update the set of protos to accept the local secret
nonces over RPC. This is actually a 97 byte value, as it includes the
two 32 byte nonces, as well as the 33 byte value of the public key of
the signer.

This is needed in order to be able to open taproot channels over the RPC
interface.
2023-09-18 11:42:15 -07:00
Olaoluwa Osuntokun
ce93b236aa
input+lnwallet: modify musig2 interfaces use explicit optional local nonces
In this commit, we modify the musig2 interfaces to instead use an
explicit value for the local nonces. Before this commit, we used the
functional option, but we want to also support specifying this value
over RPC for the remote signer. The functional option pattern is opaque,
so we can't get the nonce value we need. To get around this, we'll just
make this an explicit pointer, then map this to the functional option at
the very last moment.
2023-09-18 11:42:13 -07:00
Olaoluwa Osuntokun
2d5c0c9b4e
Merge pull request #7985 from Roasbeef/graceful-data-loss-fc
lnwallet+contractcourt: gracefully handle auto force close post data …
2023-09-15 18:30:53 -07:00
Olaoluwa Osuntokun
de54a603b7
lnwallet+contractcourt: gracefully handle auto force close post data loss
In this commit, update the start up logic to gracefully handle a
seemingly rare case. In this case, a peer detects local data loss with a
set of active HTLCs. These HTLCs then eventually expire (they may or may
not actually "exist"), causing a force close decision. Before this PR,
this attempt would fail with a fatal error that can impede start up.

To better handle such a scenario, we'll now catch the error when we fail
to force close due to entering the DLP and instead terminate the state
machine at the broadcast state. When a commitment transaction eventually
confirms, we'll play it as normal.

Fixes https://github.com/lightningnetwork/lnd/issues/7984
2023-09-15 18:29:09 -07:00
Olaoluwa Osuntokun
90effda090
Merge pull request #7977 from Roasbeef/lnd-17-rc3
build: bump version to v0.17.0 rc3
2023-09-12 16:27:45 -07:00
Olaoluwa Osuntokun
1628240960
build: bump version to v0.17.0 rc3 2023-09-12 15:13:40 -07:00
Olaoluwa Osuntokun
8c53620021
Merge pull request #7966 from yyforyongyu/add-force-sweep-outgoing
contractcourt: make sure we force sweep outgoing htlcs
2023-09-12 10:12:49 -07:00
Olaoluwa Osuntokun
c77192a64d
Merge pull request #7960 from Roasbeef/update-kv-db
build: update to kvdb v1.4.3
2023-09-12 10:07:32 -07:00
Olaoluwa Osuntokun
0c815af7ff
build: update lnd sub modules, and btcd + btcutil 2023-09-11 20:35:06 -07:00
Olaoluwa Osuntokun
bb67131ce5
kvdb/sqlbase: use positive+negative build tags for new sql error parsing
In this commit, we use exhaustive build tags to ensure that we can
always build the `sqlbase` package, independent of the set build tags.
To do this, we move the type declarations _into_ the parsing functions.
This then allows us to create two versions for each db: with the db, and
without it.

To avoid a module tag round trip to get this working, we use a local
replace for now. Once this is merged in, we can do the tag (along side
rc3), then remove the replace.
2023-09-11 20:35:01 -07:00
Olaoluwa Osuntokun
30eb90d901
build: update to kvdb v1.4.3
We needed a tag after updating the module with retry for
sqlite/postgres.
2023-09-11 20:34:58 -07:00
yyforyongyu
8787c6c227
contractcourt: make sure we force sweep outgoing htlcs 2023-09-08 20:30:43 +08:00
Olaoluwa Osuntokun
fd58cbfe6b
Merge pull request #7954 from yyforyongyu/fix-chainfee-unit-test
multi: fix unit test flakes
2023-09-05 15:46:56 -07:00
Olaoluwa Osuntokun
84b2f2d0f8
Merge pull request #7955 from yyforyongyu/fix-rand-retry-delay
kvdb/sqlbase: fix params used in `randRetryDelay`
2023-09-05 15:44:49 -07:00
yyforyongyu
c568ba9fa2
github+Makefile: add new action make tidy-module-check
This commit adds `tidy-module` and `tidy-module-check` to make sure the
modules are always tidy.
2023-09-06 02:48:13 +08:00
yyforyongyu
8813bc7ba8
kvdb/sqlbase: fix build errors
We copy the `sqldb/sqlerrors.go` into `kvdb/sqlbase` to avoid import
cycles.
2023-09-06 02:48:12 +08:00
yyforyongyu
5296509474
Makefile+action: add make unit-module to test submodules
This commit adds a new command `make unit-module` to run unit tests for
submodules to avoid future build errors.
2023-09-06 02:47:55 +08:00
yyforyongyu
08f4940e88
kvdb/sqlbase: fix params used in randRetryDelay 2023-09-06 02:47:55 +08:00
Oliver Gugger
f7cb44382e
Merge pull request #7944 from positiveblue/docker-build-img
multi: bump Go versions
2023-09-05 18:47:24 +00:00
positiveblue
49e099f0a0
lnrpc: run make rpc
The docker image have been updated so we are using another protobuf
version to generate the files. The generate files include the version of
the compiler used to creating them, so we need this commit to pass the
`rpc-check` step in our CI.
2023-09-05 10:11:51 -07:00
positiveblue
09d21345e1
multi: bump Go version
Bump all build go versions to v1.21.0
Bump the minimum build package version to v1.19.0

Debian "buster" is not longer supported. Security updates have been
discontinued since June 30th 2022. We will build using the latest
version, "bookworm".
2023-09-05 10:11:42 -07:00
Oliver Gugger
4d2481a0c3
Merge pull request #7957 from yyforyongyu/workspace-sync
gomod: sync versions for submodules
2023-09-05 13:05:35 +02:00
yyforyongyu
50f2c277d7
aezeed: fix flake in TestDecipherIncorrectMnemonic 2023-09-05 07:44:02 +08:00
yyforyongyu
a252cb4528
contractcourt: fix test flake in TestTaprootBriefcase
When the numTweaks is zero, we should return a nil instead of
initializing an empty map as we'd get the following error,

```
Diff:
--- Expected
+++ Actual
@@ -11007,4 +11007,3 @@
},
-  BreachedHtlcTweaks: (contractcourt.htlcTapTweaks) {
-  },
+  BreachedHtlcTweaks: (contractcourt.htlcTapTweaks) <nil>,
```
2023-09-05 07:44:02 +08:00
yyforyongyu
1968034075
chainntnfs: fix testHistoricalConfDetailsTxIndex
Fix the following uint test flake,
```
--- FAIL: TestHistoricalConfDetailsTxIndex (0.00s)
    --- FAIL: TestHistoricalConfDetailsTxIndex/rpc_polling_enabled (1.16s)
        bitcoind_test.go:174: should have found the transaction within the mempool, but did not: TxNotFoundIndex
FAIL
```
2023-09-05 07:44:01 +08:00
yyforyongyu
d8924d26ce
chainfee: fix unit test for WebAPIEstimator 2023-09-05 07:44:01 +08:00
yyforyongyu
68e6cd5c2e
gomod: run go work sync to sync modules
This commit is the result of running `go work sync` and `go mod tidy`
that syncs module versions for all submodules.
2023-09-05 07:27:20 +08:00
yyforyongyu
61d882b999
gomod: fix version conflict in golang.org/x/time
This commit fixes the error,
```
go: version constraints conflict:
	github.com/dhui/dktest@v0.3.16 requires golang.org/x/time@v0.0.0-20220224211638-0e9765cccd65, but golang.org/x/time@v0.0.0-20210220033141-f8bda1e9f3ba is requested
	github.com/golang-migrate/migrate/v4@v4.16.1 requires golang.org/x/time@v0.0.0-20220224211638-0e9765cccd65, but golang.org/x/time@v0.0.0-20210220033141-f8bda1e9f3ba is requested
```

By calling `go get golang.org/x/time@v0.0.0-20220224211638-0e9765cccd65"
and `go mod tidy`.
2023-09-05 06:38:12 +08:00
yyforyongyu
036f2a0f03
kvdb: fix version conflict in github.com/ulikunitz/xz
Fix the following conflict,
```
go: conflicting replacements for github.com/ulikunitz/xz:
	github.com/ulikunitz/xz@v0.5.11
	github.com/ulikunitz/xz@v0.5.8
```
2023-09-05 05:48:36 +08:00
Olaoluwa Osuntokun
13568fd5b0
build: bump version to v0.17.0-rc2 (#7942) 2023-08-30 20:14:25 -07:00
Olaoluwa Osuntokun
01c64712a3
multi: ensure link is always torn down due to db failures, add exponential back off for sql-kvdb failures (#7927)
* lnwallet: fix log output msg

The log message is off by one.

* htlcswitch: fail channel when revoking it fails.

When the revocation of a channel state fails after receiving a new
CommitmentSigned msg we have to fail the channel otherwise we
continue with an unclean state.

* docs: update release-docs

* htlcswitch: tear down connection if revocation processing fails

If we couldn't revoke due to a DB error, then we want to also tear down
the connection, as we don't want the other party to continue to send
updates. That may lead to de-sync'd state an eventual force close.
Otherwise, the database might be able to recover come the next
reconnection attempt.

* kvdb: use sql.LevelSerializable for all backends

In this commit, we modify the default isolation level to be
`sql.LevelSerializable. This is the strictness isolation type for
postgres. For sqlite, there's only ever a single writer, so this doesn't
apply directly.

* kvdb/sqlbase: add randomized exponential backoff for serialization failures

In this commit, we add randomized exponential backoff for serialization
failures. For postgres, we''ll his this any time a transaction set fails
to be linearized. For sqlite, we'll his this if we have many writers
trying to grab the write lock at time same time, manifesting as a
`SQLITE_BUSY` error code.

As is, we'll retry up to 10 times, waiting a minimum of 50 miliseconds
between each attempt, up to 5 seconds without any delay at all. For
sqlite, this is also bounded by the busy timeout set, which applies on
top of this retry logic (block for busy timeout seconds, then apply this
back off logic).

* docs/release-notes: add entry for sqlite/postgres tx retry

---------

Co-authored-by: ziggie <ziggie1984@protonmail.com>
2023-08-30 16:48:00 -07:00
Olaoluwa Osuntokun
eb0d8af645
peer: eliminate circular waiting by calling maybeSendNodeAnn async (#7938)
In this commit, we attempt to fix circular waiting scenario introduced
inadvertently when [fixing a race condition
scenario](https://github.com/lightningnetwork/lnd/pull/7856). With that
PR, we added a new channel that would block `Disconnect`, and
`WaitForDisconnect` to ensure that only until the `Start` method has
finished would those calls be allowed to succeed.

The issue is that if the server is trying to disconnect a peer due to a
concurrent connection, but `Start` is blocked on `maybeSendNodeAnn`,
which then wants to grab the main server mutex, then `Start` can never
exit, which causes `startReady` to never be closed, which then causes
the server to be blocked.

This PR attempts to fix the issue by calling `maybeSendNodeAnn` in a
goroutine, so it can grab the server mutex and not block the `Start`
method.

Fixes https://github.com/lightningnetwork/lnd/issues/7924

Fixes https://github.com/lightningnetwork/lnd/issues/7928

Fixes https://github.com/lightningnetwork/lnd/issues/7866
2023-08-30 15:47:45 -07:00
Yong
d24f12bd0b
contractcourt: fix potential panic during startup (#7936)
Related to this fix 5a28582719, we may not
have the historical data for old channels so we skip it here too.
2023-08-29 10:27:09 -07:00
Oliver Gugger
73bf21e0f2
Merge pull request #7932 from guggero/psbt-funding-taproot-chans
psbt: fix channel funding address for simple taproot channels
2023-08-29 14:06:17 +02:00
Oliver Gugger
590dc0c3b3
itest: unify PSBT channel funding tests, add taproot
With this commit we unify three existing PSBT channel funding
integration tests into a single one with the goal of testing all three
cases with simple taproot channels as well.
2023-08-29 10:57:38 +02:00
Oliver Gugger
646444cdfe
chanfunding: fix PSBT funding for taproot chans 2023-08-29 10:57:38 +02:00
Oliver Gugger
c6fcceb35b
Merge pull request #7909 from patrickReiis/master
itest: fix typo [skip ci]
2023-08-28 16:39:40 +02:00
Jamal James
cbb4c27a44
docs: fix simple-taproot-channels typo [skip ci] (#7926) 2023-08-25 15:48:37 -07:00
Elle
15d2ff0c4d
netann+docs: remove nil value from variadic list (#7922)
The nil value in the variadic list causes a panic when the variadic
parameters are iterated over.
2023-08-24 11:47:42 -07:00
Olaoluwa Osuntokun
dde1495e1d
build: bump Go version to v1.21.0, lnd version to v0.17.0 rc1 (#7914)
* build: update Go version to 1.21.0

* build: bump version to v0.17.0 rc1
2023-08-23 17:33:11 -07:00
Suheb
c07ec0462c
docs/release-notes: update 0.17 release notes to new format (#7907)
Added a table of contents at the top and various sections to navigate to, to make it easy to parse and read the release notes.
2023-08-23 15:21:20 -07:00
Olaoluwa Osuntokun
251bcad899
Merge pull request #7877 from ellemouton/bumpOnion
multi: update lightning-onion version
2023-08-23 12:22:15 -07:00
P. Reis
5fc77b6ee5
doc: fix typo
Changed "chanenl" to "channel"
2023-08-23 12:55:01 -03:00
Elle Mouton
dfec4a65cb
multi: update lightning-onion version
Update the lighting-onion dependency to include the lates changes which
support route blinding.
2023-08-23 12:09:53 +02:00
Olaoluwa Osuntokun
e2f5374f67
Merge pull request #7904 from lightningnetwork/simple-taproot-chans-staging
multi: merge simple taproot channels staging branch into master
2023-08-22 19:24:31 -07:00
Olaoluwa Osuntokun
a87631c957
itest: add case for taproot chans to htlc timeout resolver itests 2023-08-22 17:43:51 -07:00
Olaoluwa Osuntokun
92da6b1d44
multi: fix linter warnings with updated linter 2023-08-22 16:34:47 -07:00
Olaoluwa Osuntokun
7506383074
itest: update zero conf multi-hop tests to remove extra blocks mined
In the master branch, the blocks are mined earlier, so we don't need to
mine an extra set.
2023-08-22 16:34:42 -07:00
Olaoluwa Osuntokun
562163ea3d
docs/release-notes: add release notes for taproot chans 2023-08-22 16:34:39 -07:00
Olaoluwa Osuntokun
3f8d33d7ab
funding: add SIMPLE_TAPROOT case to TestCommitmentTypeFundmaxSanityCheck 2023-08-22 16:34:36 -07:00