Commit Graph

486 Commits

Author SHA1 Message Date
Carla Kirk-Cohen
fd8381bf2a
lnwire: add invalid onion blinding error code 2023-12-12 09:44:05 -05:00
Elle Mouton
49a0370dcd
lnwire: add timestamps to ReplyChannelRange msg 2023-12-11 09:12:04 +02:00
Elle Mouton
4872010779
lnwire: sort scids before encoding
This is for later when the timestamps also need to be sorted according
to the SCIDs.
2023-12-11 09:12:04 +02:00
Elle Mouton
c882223ead
lnwire+discovery: rename ShortChannelIDEncoding to QueryEncoding
Since the the encoding can be used for multiple different fields, we
rename it here to be more generic.
2023-12-11 09:12:04 +02:00
Elle Mouton
341bae098c
lnwire: add QueryOptions to QueryChannelRange 2023-12-11 09:12:04 +02:00
Elle Mouton
8efd141347
lnwire: add QueryOptions type
This commit adds a new QueryOptions type which will later be used in the
QueryReplyRange message.
2023-12-11 09:12:03 +02:00
Keagan McClelland
9793fbb94b lnwire: add musig2 taproot execution messages for dynamic commitments 2023-11-10 13:29:52 -08:00
Keagan McClelland
564bf852bb lnwire: add fuzz tests for new dynamic commitment message types 2023-11-10 13:29:30 -08:00
Keagan McClelland
3e84d22eeb lnwire: add TLV extension to channel_reestablish for dynamic commitments 2023-11-10 13:29:30 -08:00
Keagan McClelland
e5f7ed8ba1 lnwire: introduce message types for dynamic commitment negotiation
lnwire: add tests for dynamic commitment wire serialization
2023-11-10 13:29:30 -08:00
Matt Morehouse
ed1b54ac3a
lnwire: use require package for onion failure fuzz tests 2023-10-27 14:52:00 -05:00
Matt Morehouse
a7ee45bea0
lnwire: add FuzzFailIncorrectDetails test
The test is identical to other onion failure fuzz tests, except that it
uses a custom equality function to get around the nil != []byte{} issue
with reflect.DeepEqual.
2023-10-27 14:52:00 -05:00
Matt Morehouse
2181fd432c
lnwire: fuzz onion failure messages
Fuzz tests for decoding and encoding of onion failure messages, based on
the fuzz harness for other lnwire messages. The onion failure messages
were uncovered by existing fuzz tests.
2023-10-27 14:12:41 -05:00
Matt Morehouse
3549e329df lnwire: encode channel_update type in onion errors
For about a year [1], the spec has prescribed encoding channel_updates
with their type prefix (0x0102) in onion failure messages. LND can
decode correctly with or without the prefix but hasn't been writing the
prefix during encoding. This commit starts writing the prefix.

[1] https://github.com/lightning/bolts/pull/979
2023-10-06 16:34:47 -07:00
Michael Rooke
78d9996620
trivial: Fix spelling errors
- Fixes some spelling in code comments and a couple of function names
2023-09-21 22:35:33 -04:00
Olaoluwa Osuntokun
92da6b1d44
multi: fix linter warnings with updated linter 2023-08-22 16:34:47 -07:00
Olaoluwa Osuntokun
384b1b1c12
feature: use +100 staging bit for taproot channels
In this commit, we carry out a new notion introduced during a recent
spec meeting to use a feature bit plus 100 before the feature has been
finalized in the spec.

We split into the Final and Staging bits.
2023-08-22 16:34:28 -07:00
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