Commit Graph

469 Commits

Author SHA1 Message Date
Olaoluwa Osuntokun
9851a6147b
lnwire: TestLightningWireProtocol quick check tests for taproot fields 2023-08-22 16:29:49 -07:00
Olaoluwa Osuntokun
7ae4bf0672
lnwire: sort records in ExtractRecords
This ensures that the caller doesn't need to worry about the TLV type
ordering of the records the pass into the function.
2023-08-22 16:29:47 -07:00
Olaoluwa Osuntokun
25dfbadd23
lnwire: add ShutdownNonce to Shutdown 2023-08-22 16:29:45 -07:00
Olaoluwa Osuntokun
ca4609e394
lnwire: add LocalNonce to RevokeAndAck 2023-08-22 16:29:42 -07:00
Olaoluwa Osuntokun
4a62652ad2
lnwire: add PartialSig to CommitSig 2023-08-22 16:29:40 -07:00
Olaoluwa Osuntokun
5223b6f381
lnwire: add LocalNonce to ChannelReestablish 2023-08-22 16:29:38 -07:00
Olaoluwa Osuntokun
8afb60da17
lnwire: add LocalNonce to FundingLocked 2023-08-22 16:29:36 -07:00
Olaoluwa Osuntokun
79c473cc46
lnwire: add PartialSig to FundingSigned 2023-08-22 16:29:34 -07:00
Olaoluwa Osuntokun
292b8db8f0
lnwire: add PartialSig to FundingCreated 2023-08-22 16:29:31 -07:00
Olaoluwa Osuntokun
ee279fbde3
lnwire: add LocalNonce to AcceptChannel 2023-08-22 16:29:29 -07:00
Olaoluwa Osuntokun
7c5ba067ab
lnwire: add LocalNonce to OpenChannel 2023-08-22 16:29:27 -07:00
Olaoluwa Osuntokun
14949c972d
lnwire: add new musig2 partial signature type
In this commit, we add the new types that'll house musig signatures with
and without their nonces. We send the nonce along with the sig
everywhere but the co-op close flow.
2023-08-22 16:29:24 -07:00
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
yyforyongyu
70bd6d1a11
lnwire: fix unit test flake for Ping message 2023-08-17 23:51:04 +08:00
Oliver Gugger
56dba2df03
multi: update linter, fix new issues 2023-06-13 11:58:33 +02:00
Matt Morehouse
460ba4ad82
lnwire: use require package for fuzz tests
Simplify code by using the require package instead of t.Fatal().
2023-05-23 08:37:22 -05:00
Matt Morehouse
e198e6693f
lnwire: add FuzzConvertFixedSignature test
Test conversion of fixed 64-byte signatures to DER-encoded signatures.
2023-05-12 11:07:57 -05:00
Matt Morehouse
a6a7066454
lnwire: add FuzzParseRawSignature test
Test parsing and serialization of raw DER-encoded signatures.
2023-05-12 11:07:54 -05:00
ziggie
8f4e9d68d0
lnwire_test: fix BenchmarkReadMessage test
The addition of AliasScid in the tlv_stream field of the
funding_locked msg made the requirement for testdata of the
ExtraOpaqueData part for the funding_locked msg type more strict.
Now the input testdata for the funding_locked test is more specific
and includes the new added AliasScid tlv record.
2023-05-09 16:47:44 +02:00
Carla Kirk-Cohen
019127c4f4
multi: add restriction on maximum feature bit in invoices
Base 32 encoded bolt 11 invoices only allow 10 bits to express the
length of the feature vector in a tagged field, so there is a much
lower limit on the values invoice custom features can hold.

Other places in the protocol are theoretically limited by the maximum
message size, but since we express a feature bit as u16 we don't need
to be concerned about this.

The decision is made to track maximum per-set in the feature manager,
which is conceptually aware of sets and then validate in lnwire/features
against some arbitrary maximum value provided to the caller to keep
the base features package unaware of sets.
2023-05-04 10:35:45 -04:00
Carla Kirk-Cohen
1a9d743e18
lnwire: add feature vector update validation helpers 2023-05-04 10:35:43 -04:00
yyforyongyu
dc3f83c670
funding+lnwire: rename and fix make lint
Fix linter and rename `funding_locked.go` to `channel_ready.go`
2023-03-17 18:21:59 +08:00
yyforyongyu
6b9217acfc
multi: replace FundingLocked related docs
This commit replaces `FundingLocked` found in docs using the following
command,
```shell
find . -name "*.go" -exec sed -i '' 's/FundingLocked/ChannelReady/g' {} \;
find . -name "*.go" -exec sed -i '' 's/FundingLock/ChannelReady/g' {} \;
```
2023-03-17 18:21:59 +08:00
yyforyongyu
f8a8326141
multi: replace FundingLocked and funding_locked strings
This commit is created by running the following commands,
```shell
find . -name "*.go" -exec sed -i '' 's/\"FundingLocked/\"ChannelReady/g' {} \;
find . -name "*.go" -exec sed -i '' 's/FundingLocked\"/ChannelReady\"/g' {} \;
find . -name "*.go" -exec sed -i '' 's/\ funding_locked/\ channel_ready/g' {} \;
```
2023-03-17 18:21:59 +08:00
yyforyongyu
015446559b
funding+lnwire: rename FundingLocked related tests
This commit is created by running the following commands,

```shell
gofmt -d -w -r 'fundingLockedAlice -> channelReadyAlice' .
gofmt -d -w -r 'fundingLockedBob -> channelReadyBob' .
gofmt -d -w -r 'assertHandleFundingLocked -> assertHandleChannelReady' .
gofmt -d -w -r 'assertFundingLockedSent -> assertChannelReadySent' .
gofmt -d -w -r 'aliceFundingLocked -> aliceChannelReady' .
gofmt -d -w -r 'bobFundingLocked -> bobChannelReady' .
gofmt -d -w -r 'FuzzFundingLocked -> FuzzChannelReady' .
gofmt -d -w -r 'newMsgFundingLocked -> newMsgChannelReady' .
gofmt -d -w -r 'TestFundingManagerReceiveFundingLockedTwice -> TestFundingManagerReceiveChannelReadyTwice' .
gofmt -d -w -r 'TestFundingManagerRestartAfterReceivingFundingLocked -> TestFundingManagerRestartAfterReceivingChannelReady' .
```
2023-03-17 18:21:59 +08:00
yyforyongyu
2dc08a2a76
multi: rename NewFundingLocked to NewChannelReady
This commit is created by the following command,

```shell
gofmt -d -w -r 'NewFundingLocked -> NewChannelReady' .
```
2023-03-17 18:21:58 +08:00
yyforyongyu
c8e8358918
channeldb+lnwire: rename MsgFundingLocked to MsgChannelReady
This commit is created by running,

```shell
gofmt -d -w -r 'MsgFundingLocked -> MsgChannelReady' .

gco master channeldb/migration
```
2023-03-17 18:21:58 +08:00
yyforyongyu
1b7c56b2ed
multi: rename FundingLocked to ChannelReady
This commit is created by running,

```shell
gofmt -d -w -r 'FundingLocked -> ChannelReady' .

gco master channeldb/migration
```
2023-03-17 18:21:58 +08:00
bitromortac
dd5273c88c
multi: rename due to required maxHTLC bit
We rename `ChanUpdateOptionMaxHtlc` to `ChanUpdateRequiredMaxHtlc`
as with the latest changes it is now required.

Similarly, rename `validateOptionalFields` to
`ValidateChannelUpdateFields`, export it to use it in a later commit.
2023-02-21 11:10:39 +01:00
ziggie
88a8c6618d
lnwire: add custom message to fuzz tests 2023-01-21 08:46:55 +01:00
Carla Kirk-Cohen
93dcbd7ea3
lnwire: allow overriding of protocol messages outside of custom range
Add the ability to specify messages < CustomRangeStart that will still
be treated like custom messages by lnd (rather than unknown ones). This
allows code external to lnd to handle protocol messages that are *not
yet known to lnd*.
2023-01-05 12:05:04 -05:00
Carla Kirk-Cohen
610f5d2140
lnwire: make custom type start a constant 2023-01-05 12:05:03 -05:00
Oliver Gugger
04dc37e463
lnwire: remove nolint comment 2023-01-05 08:49:31 +01:00
Joost Jager
3835b903a9
lnwire: limit channel update reader
Fixes a bug where channel update data is read until the end of the stream
rather than stopping after the specified length. This is problematic
when failure message tlv data is present, because this data is interpreted
as channel update tlv data.
2023-01-04 13:32:52 +01:00
eugene
032632b4e0
multi: update to tlv/v1.1.0 and use new *P2P tlv decoding variants
This changes the call-sites in several places to use the *P2P variants
to not trigger an OOM on untrusted input. This makes the code safe with
the new tlv version. Note that the call-sites prior to this change were
also safe.
2022-12-05 09:32:56 -05:00
Joost Jager
4c8ea29336
lnwire: allow longer failure messages
This fixes an incompatibility where lnd enforces a strict 256 byte
failure message, where as the spec sets this only as the recommended
length.
2022-12-02 14:27:59 +01:00
Joost Jager
5ff5838d74
lnwire: add extra opaque data to FailIncorrectDetails 2022-12-02 09:28:03 +01:00
Joost Jager
9730bc1ca0
lnwire: verify failure message length
Adds extra checks to make sure the failure message
is well-formed.
2022-12-02 09:04:59 +01:00
Matt Morehouse
f0f99d7e36
lnwire: add fuzz test for Warning 2022-11-11 11:56:49 -06:00
Matt Morehouse
258cf6466d
lnwire: add benchmark for Warning 2022-11-11 11:56:49 -06:00
Matt Morehouse
e15d3e898e
brontide,lnwire,wtwire,zpay32: appease linter
Address all linter complaints for the newly migrated fuzz tests.
2022-11-11 08:44:30 -06:00
Matt Morehouse
5a48568806
brontide,lnwire,wtwire,zpay32: use CamelCase
Rename fuzz test functions to use CamelCase.
2022-11-11 08:44:24 -06:00
Conner
3d4d8cd6cc
lnwire: migrate fuzz tests 2022-11-11 08:43:32 -06:00
Oliver Gugger
84401f6f6c
Merge pull request #7039 from TonyGiorgio/sync-7034
Remove ErrSynchronizingChain
2022-10-31 08:35:48 +01:00
habibitcoin
0b1e881d18
scripted-diff: replace ⛰ emoji with $ [skip ci]
-BEGIN VERIFY SCRIPT-
sed -i 's/⛰/$/g' $(git grep -l '⛰')
-END VERIFY SCRIPT-
2022-10-28 12:06:49 -04:00
Tony Giorgio
09537596fc
funding+lnwire: remove ErrSynchronizingChain 2022-10-28 10:06:59 -05:00
positiveblue
4d4d8e480c
multi: stop casting peer warning messages as errors
Split the logic for processing `error` and `warning` messages from our
peers.
2022-10-26 08:09:08 -07:00
positiveblue
fbe79811cf
invoicesrpc: refactor addinvocie hop hint selection
In order to reduce the number of calls to the db we try to process as
few channels as we can + try to not do extra work for each of them.

- First fetch all the channels. Then, filter all the public ones and
  sort the potential candidates by remote balance.

- Filter out each potential candidate as soon as possible.

- Only check the alias if the channel supports scid aliases.

- Because we sort the channels by remote balance, we will hit the
  target amount, if possible, as soon as we can.

We do not want to leak information about our remote balances, so we
shuffle the hop hints (the forced ones go always first) so the invoice
receiver does not know which channels have more balance than others.
2022-09-30 06:55:10 -07:00