Commit graph

15145 commits

Author SHA1 Message Date
Olaoluwa Osuntokun
5b7caaea6d
lnwire: add new Musig2Nonce TLV record 2023-08-22 16:29:22 -07:00
Olaoluwa Osuntokun
b368e476c5
lnwire: update Sig to support both ECDSA and schnorr sigs
In this commit, we update the Sig type to support ECDSA and schnorr
signatures. We need to do this as the HTLC signatures will become
schnorr sigs for taproot channels. The current spec draft opts to
overload this field since both the sigs are actually 64 bytes in length.
The only consideration with this move is that callers need to "coerce" a
sig to the proper type if they need schnorr signatures.
2023-08-22 16:29:19 -07:00
Olaoluwa Osuntokun
eccc77315b
lnwire: add feature bits for simple taproot chans 2023-08-22 16:29:17 -07:00
Oliver Gugger
e49f6fcdd3
Merge pull request #7648 from guggero/initial-forwarding-policy
funding: fix flake in itest caused by persistent fee param changes
2023-08-22 15:15:28 +02:00
yyforyongyu
6820b08b53
funding: put assertNoFwdingPolicy in wait.NoError 2023-08-22 11:10:15 +08:00
yyforyongyu
0a6b05d2de
funding: catching barrier signal in receivedChannelReady
There is a race condition,
- goroutine_1: performing `stateStep` under `channelReadySent`. Once
  `receivedChannelReady` returns true, it will mark the channel state as
  `addedToRouterGraph`, which will delete the initial forwarding policy
  for private channels.
- goroutine_2: performing `handleChannelReady`, which processes the
  remote's channelReady message. It will ask brontide to `AddNewChannel`
  in the end.
- goroutine_3: performing `handleNewActiveChannel` in brontide, which
  will query the initial forwarding policy and fail to find it because
  it's already deleted in goroutine_1.

To fix it, we require `receivedChannelReady` to also check that the
channel's barrier signal in the map `handleChannelReadyBarriers` doesn't
exist, as this signal is removed once `handleChannelReady` finishes
adding the channel in brontide.
2023-08-22 09:52:49 +08:00
yyforyongyu
32d8208272
funding: add new method handleChannelReadyReceived
This commit is a pure code move. We add a new method
`handleChannelReadyReceived` to handle the channel's state change after
the remote's channel ready message is received.
2023-08-22 09:52:46 +08:00
yyforyongyu
d9e0464929
funding: defer initial forwarding policy deletion
This commit moves the deletion of the initial forwarding policy to the
end of `stateStep` to make sure the router has persisted it to disk
before the deletion.
2023-08-22 08:21:53 +08:00
yyforyongyu
38b106ccf3
funding: rename channelReady to channelReadySent for clarity 2023-08-22 07:04:17 +08:00
Oliver Gugger
d822d75f00
server+funding: remove previous link update mechanism
Because we now send the correct initial forwarding policy to Brontide,
the correct initial values are inserted into the link and we no longer
need to update the link in a later step.
2023-08-22 06:22:34 +08:00
Oliver Gugger
fb36806724
peer: load initial forwarding policy from channel DB 2023-08-22 06:22:34 +08:00
Oliver Gugger
7ac445caaf
funding: make sure initial policy is always set 2023-08-22 06:22:34 +08:00
Oliver Gugger
d5c504c8de
multi: use fwding policy from models pkg 2023-08-22 06:22:33 +08:00
Oliver Gugger
59b5fb1565
channeldb+funding: move policy encoding into channel DB 2023-08-22 06:22:33 +08:00
Oliver Gugger
36fcf65e97
funding+channeldb: rename fwding -> forwarding 2023-08-18 09:44:23 +02:00
Oliver Gugger
eda34a8d2a
channeldb: move fwding policy code to new file 2023-08-18 09:44:06 +02:00
Oliver Gugger
4770cb0aaf
manager: also store initial time lock delta and HTLC settings
This will allow us to also set the TimeLockDelta and HTLC settings
when creating the channel. We leave the actual implementation of
the RPC and CLI changes to another PR, this is just to make
things more consistent.
2023-08-18 09:44:06 +02:00
Oliver Gugger
5b9aa63cec
funding: extract defaultForwardingPolicy 2023-08-18 09:44:06 +02:00
Oliver Gugger
665179ece2
funding+server: don't use wallet DB for channel operations
Since the actual wallet backends might be different between the wallet
DB and the actual channel state DB, we pass in the correct struct to the
funding manager.
2023-08-18 09:44:05 +02:00
Oliver Gugger
4a03074fe8
Merge pull request #7894 from yyforyongyu/fix-lnwire-test-flake
trivial: fix unit test flake for `Ping` message
2023-08-18 09:42:59 +02:00
Oliver Gugger
4f9c09922a
Merge pull request #7881 from guggero/bump-neutrino-lib
mod: bump neutrino dependency to v0.16.0
2023-08-17 17:57:34 +02:00
yyforyongyu
70bd6d1a11
lnwire: fix unit test flake for Ping message 2023-08-17 23:51:04 +08:00
Oliver Gugger
d1dd2b4d11
mod: bump neutrino dependency to v0.16.0 2023-08-17 10:09:43 +02:00
Oliver Gugger
b565f4f536
Merge pull request #7880 from yyforyongyu/fix-channel-arb
trivial: fix loggings, variable names and conf notification order
2023-08-15 16:25:54 +02:00
Oliver Gugger
4ab2454880
Merge pull request #7879 from ziggie1984/remove-last-sweep-logic
Remove publishing last sweep tx logic during startup.
2023-08-15 16:21:43 +02:00
ziggie
160eab280a
docs: add release-notes. 2023-08-15 11:23:13 +02:00
ziggie
87fc58ecfe
multi: Add a channel.db migration.
The new migration removes the sweeper-last-tx top level bucket
from the channel.db database.
2023-08-15 10:00:30 +02:00
ziggie
07502a8fb0
sweep: Remove publishing last-tx logic.
We remove the publishing of the last published sweep tx during the
startup of the sweeper. This republishing can lead to situations
where funds of the default wallet might be locked for neutrino
backend clients.
Moreover all related tests are removed as well.
2023-08-15 10:00:29 +02:00
Olaoluwa Osuntokun
c6a68d193c
Merge pull request #7177 from morehouse/fix_chantype_negotiation
funding: fix channel type negotiation bug
2023-08-14 17:15:52 -07:00
Oliver Gugger
55cc35c6ba
Merge pull request #7870 from feelancer21/check-script-fix
scripts: Direct 'lnd --help' output to a file
2023-08-14 12:30:29 +02:00
Oliver Gugger
1f9736bafb
Merge pull request #7888 from hieblmi/fix-updatechanpolicy-typos
typos: fix updatechanpolicy typos
2023-08-14 09:52:48 +02:00
Oliver Gugger
2734fc52e1
Merge pull request #7886 from guggero/release-notes-fix
release-notes: remove duplicate Misc section, fix formatting and punctuation
2023-08-14 09:40:11 +02:00
Matt Morehouse
e6a2167f38
funding: refactor negotiateCommitmentType
- use a switch instead of nested ifs to improve readability
- improve some variable names
- reword comments
2023-08-11 11:20:07 -05:00
Slyghtning
ab117a0ed4
typos: fix updatechanpolicy typos 2023-08-11 17:04:36 +02:00
Oliver Gugger
1057422aba
release-notes: fix formatting, punctuation 2023-08-11 11:27:27 +02:00
Oliver Gugger
00a4b8a837
release-notes: collapse duplicate Misc section 2023-08-11 08:50:49 +02:00
yyforyongyu
92671ad250
contractcourt: register conf notification before publish tx
This commit moves the confirmation registration before publishing the tx
to make sure the conf event won't be missed.
2023-08-10 20:36:41 +08:00
yyforyongyu
a1671a8674
contractcourt: rename htlcResolvers to resolvers
This commit changes the name returned from `prepContractResolutions`
from `htlcResolvers` to `resolvers` to avoid confusion as there are
multiple types of resolvers returned.
2023-08-10 20:25:15 +08:00
Oliver Gugger
d930dcec40
Merge pull request #7819 from ziggie1984/abandonchannel-rebroadcaster
Cancel the Rebroadcasting of a Transaction when Abandoning a Channel
2023-08-10 10:43:24 +02:00
yyforyongyu
aff4320208
multi: improve logging re resolution flow 2023-08-10 13:50:03 +08:00
Olaoluwa Osuntokun
8f693fe020
Merge pull request #7518 from yyforyongyu/fix-channel-ready-race
Fix race between `channel_ready` and link update
2023-08-08 17:10:31 -07:00
yyforyongyu
f9d4212ecc
peer: send msgs to chanStream for both active and pending channels
This commit now sends messages to `chanStream` for both pending and
active channels. If the message is sent to a pending channel, it will be
queued in `chanStream`. Once the channel link becomes active, the early
messages will be processed.
2023-08-09 01:29:19 +08:00
yyforyongyu
a9da25b238
golangci: update linter settings for test files 2023-08-09 01:29:19 +08:00
yyforyongyu
0dd2aa0aef
multi: add itest to check race between channel_ready and update_add_htlc
This commit adds a new itest case to check the race condition found in
issue #7401. In order to control the funding manager's state, a new dev
config for the funding manager is introduced to specify a duration we
should hold before processing remote node's channel_ready message.

A new development config, `DevConfig` is introduced in `lncfg` and will
only have effect if built with flag `integration`. This can also be
extended for future integration tests if more dev-only flags are needed.
2023-08-09 01:29:19 +08:00
yyforyongyu
6b41289538
multi: patch unit tests for handling pending channels 2023-08-09 01:29:19 +08:00
yyforyongyu
d28242c664
peer: return an error from updateNextRevocation and patch unit tests
This commit makes the `updateNextRevocation` to return an error and
further feed it through the request's error chan so it'd be handled by
the caller.
2023-08-09 01:29:18 +08:00
yyforyongyu
927572583b
multi: remove pending channel from Brontide when funding flow failed
This commit adds a new interface method, `RemovePendingChannel`, to be
used when the funding flow is failed after calling `AddPendingChannel`
such that the Brontide has the most up-to-date view of the active
channels.
2023-08-09 01:29:18 +08:00
yyforyongyu
3ed579d06f
funding: make failFundingFlow takes both channel IDs
This commit adds a new struct `chanIdentifier` which wraps the pending
channel ID and active channel ID. This struct is then used in
`failFundingFlow` so the channel ID can be access there.
2023-08-09 01:29:18 +08:00
yyforyongyu
048d7d7c36
docs: update release note for race fix 2023-08-09 00:17:23 +08:00
yyforyongyu
3eb7f54a6d
peer: add method handleLinkUpdateMsg to handle channel update msgs 2023-08-09 00:17:23 +08:00