Commit Graph

512 Commits

Author SHA1 Message Date
ffranr
9f3593a341
lnwire: add type CustomRecords
This commit introduces the `CustomRecords` type in the `lnwire` package,
designed to hold arbitrary byte slices. Each entry in this map can
associate with TLV type values that are greater than or equal to 65536.
2024-08-22 18:33:24 +02:00
Elle Mouton
f1a58dcab1
lnwire: update Bolt11 blinded path feature bits
so that they dont clash with the htlc-endorsement feature bits.
2024-08-07 20:13:34 +02:00
Keagan McClelland
b172227cb3
lnwire: add Stfu to LinkUpdater interface 2024-08-05 17:23:19 -07:00
Keagan McClelland
0176fca826
lnwire: add wire type for stfu 2024-08-05 17:22:56 -07:00
Elle Mouton
9192c165ff
feature: define new feature bit for bolt11 blinded paths
We need a new feature bit for BOLT11 invoices in order to indicate that
they contain the new blinded path tagged field. Tagged fields pre-date
TLV and so nodes who dont understand them will simply skip them.
Therefore the feature bit helps them to fail fast.
2024-07-26 09:53:49 +02:00
Carla Kirk-Cohen
eaa85920ea
multi: enable optional route blinding feature 2024-04-26 11:35:17 -04:00
erik
c7f81d3142 multi: replace ioutil.Discard 2024-04-25 11:23:54 +02:00
Carla Kirk-Cohen
7fd9c2a7f8
multi: use some record for payment descriptor blinding point 2024-04-02 15:44:05 -04:00
Joost Jager
3e6adbf1c0 lnwire+channeldb: parse inbound fees
In this commit, the tlv extension of a channel update message is parsed.
If an inbound fee schedule is encountered, it is reported in the
graph rpc calls.
2024-03-31 16:33:26 +02:00
Carla Kirk-Cohen
f090a64142
multi: add blinding point to payment descriptor and persist
This commit adds an optional blinding point to payment descriptors and
persists them in our HTLC's extra data. A get/set pattern is used to
populate the ExtraData on our disk representation of the HTLC so that
callers do not need to worry about the underlying storage detail.
2024-03-27 09:38:56 -04:00
Carla Kirk-Cohen
e4f90ec593
lnwire: add blinding point to update_add_htlc TLVs
Add blinding points to update_add_htlc. This TLV will be set for
nodes that are relaying payments in blinded routes that are _not_
the introduction node.
2024-03-27 09:38:50 -04:00
Carla Kirk-Cohen
d8979d3086
multi: add validation of blinded route encrypted data
Co-authored-by: Calvin Zachman <calvin.zachman@protonmail.com>
2024-03-27 09:36:40 -04:00
Carla Kirk-Cohen
c48841a38b
record: add TLV encoding/decoding for blinded route data blobs
This commit adds encoding and decoding for blinded route data blobs.
TLV fields such as path_id (which are only used for the final hop)
are omitted to minimize the change size.
2024-03-27 09:36:39 -04:00
Carla Kirk-Cohen
3cc50ced55
lnwire: create common encoder/decoder for raw feature vectors
We'll need to pack feature vectors for route blinding, so we pull
the encoding/decoding out into separate functions (currently
contained in ChannelType). Though it's more lines of code, we keep
most of the ChannelType assertions so that we strictly enforce
use of the alias.
2024-03-27 09:36:38 -04:00
Oliver Gugger
1422df27b2
Merge pull request #8521 from zhiqiangxu/typo
chore: fix typo
2024-03-22 01:34:57 -06:00
zhiqiangxu
74a290b46d lnwallet+input: fix a few typoes 2024-03-21 15:44:45 +08:00
zhiqiangxu
cbf676e404 lnwire: fix deprecated usage 2024-03-21 10:05:17 +08:00
Keagan McClelland
db39a905cb multi: make NewChanIDFromOutpoint accept value instead of pointer 2024-03-08 15:47:55 -08:00
ProofOfKeags
56f17afeeb
Merge pull request #8517 from ProofOfKeags/cleanup/link-weeds
htlcswitch+peer+lnwire: pull weeds
2024-03-06 16:05:44 -07:00
Keagan McClelland
59700892b7 lnwire: make LinkUpdater a subclass of Message
Conceptually, all messages that are capable of identifying the
channel_id on which they operate are themselves messages. Here we
codify this.
2024-03-06 11:59:19 -08:00
Keagan McClelland
f5f0286e34 peer+lnwire: move LinkUpdater to lnwire
The purpose of this interface is to distinguish messages that are
bound to a particular channel_id from those that are not. There is
no reason this ought to be a property of the peer package as it is
entirely determined by the contents of the message itself. Therefore
we move it to the lnwire package so it can be used without having
import cycles elsewhere in the codebase.
2024-03-06 11:59:19 -08:00
Olaoluwa Osuntokun
7feb8b21e1
multi: upgrade new taproot TLVs to use tlv.OptionalRecordT
In this commit, we update new Taproot related TLVs (nonces, partial sig,
sig with nonce, etc). Along the way we were able to get rid of some
boiler plate, but most importantly, we're able to better protect against
API misuse (using a nonce that isn't initialized, etc) with the new
options API. In some areas this introduces a bit of extra boiler plate,
and where applicable I used some new helper functions to help cut down
on the noise.

Note to reviewers: this is done as a single commit, as changing the API
breaks all callers, so if we want things to compile it needs to be in a
wumbo commit.
2024-02-29 11:32:26 -06:00
ffranr
cd566eb097
multi: fix fmt.Errorf error wrapping
Refactor fmt.Errorf usage to correctly wrap errors instead of using
non-wrapping format verbs.
2024-02-27 11:13:40 +00:00
Olaoluwa Osuntokun
5953eaa9d8
lnwire: add fuzz tests for ClosingComplete+ClosingSigs 2024-02-05 16:30:26 -08:00
Olaoluwa Osuntokun
3d88017b38
lnwire: add new closing_complete and closing_sig messages
These two messages will be used to implement the new and improved co-op
closing protocol. This PR also show cases how to use the new
`tlv.OptionalRecord` type to define and handle TLV level parsing.

I think we can make one additional helper function to clean up some of
the boiler plate for the encode/decode.
2024-02-05 16:30:23 -08:00
Olaoluwa Osuntokun
34fd35bc63
lnwire: add Record() method to lnwire.Sig
We'll use this later on to re-use the normal primitive record to create
a series of new TLV types for the new co-op close protocol.
2024-02-05 16:30:16 -08:00
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