Commit Graph

536 Commits

Author SHA1 Message Date
Oliver Gugger
83923c7f33
lnwire: add MergedCopy method to CustomRecords 2024-09-19 09:21:38 +02:00
Oliver Gugger
cdad5d988d
Merge pull request #9072 from lightningnetwork/extract-part3-from-staging-branch
[custom channels 3/5]: Extract PART3 from mega staging branch
2024-09-19 01:20:55 -06:00
Elle Mouton
580c10477f
lnwire: add ChannelUpdate2
Add the new ChannelUpdate2 message and ensure that it implements the
ChannelUpdate interface.
2024-09-18 16:20:28 +02:00
Elle Mouton
a438eb3af3
lnwire: add ChannelAnnouncement2 message
And ensure that it implements the ChannelAnnouncement interface.
2024-09-18 16:14:59 +02:00
Elle Mouton
66302ceb29
lnwire: make RawFeatureVector a Record producer 2024-09-18 16:14:58 +02:00
Elle Mouton
0b4e5a0d83
lnwire: add AnnounceSignatures2 message
And ensure that it implements the AnnounceSignatures interface.
2024-09-18 16:14:58 +02:00
Elle Mouton
34e9ee1ee5
lnwire: lnwire: add a ChannelUpdate interface
In this commit, a new ChannelUpdate interface is added and
ChannelUpdate1 is made to implement the new interface.
2024-09-18 16:14:58 +02:00
Elle Mouton
e07d23567c
lnwire: add a ChannelAnnouncement interface
Add a new ChannelAnnouncement interface and ensure that
ChannelAnnouncement1 implements it.
2024-09-18 16:13:17 +02:00
Elle Mouton
f230e2c574
lnwire: add AnnounceSignatures interface
Add a AnnounceSignatures interface and ensure that AnnounceSignatures1
implements it.
2024-09-18 16:13:17 +02:00
Elle Mouton
df65b7cad9
lnwire: add FirstBlock and BlockRange to GossipTimestampRange
Add new FirstBlockHeight and BlockRange TLV fields to the
GossipTimestampRange message. This will be used to query for Gossip 1.75
messages which are timestamped using block height instead of Unix
timestamps.
2024-09-18 16:13:17 +02:00
Elle Mouton
60b0e46c36
lnwire: add btc and node announcement nonces to channel_ready
In preparation for Gossip 1.75, we add new TLV's to the `ChannelReady`
message. Namely: `AnnouncementBitcoinNonce` and `AnnouncementNodeNonce`.
These will be used to exchange nones required for producing the partial
signature to be send in the `AnnouncementSignatures2` message.
The type numbers for these new fields are even because if they are set,
then a peer is expecting its peer to understand gossip 1.75 and the new
fields.
2024-09-18 16:13:17 +02:00
Elle Mouton
60f331edb1
multi: rename ChannelUpdate to ChannelUpdate1
In preparation for adding a new ChannelUpdate2 message and a
ChannelUpdate interface, we rename the existing message to
ChannelUpdate1.
2024-09-18 16:13:17 +02:00
Elle Mouton
bb44efa21f
multi: rename ChannelAnnouncement to ChannelAnnouncment1
In preparation for adding the new ChannelAnnouncement2 message along
with a ChannelAnnouncement interface, we rename the existing message to
ChannelAnnouncement1.
2024-09-18 16:13:17 +02:00
Elle Mouton
05d76b696d
multi: rename AnnounceSignatures to AnnounceSignatures1
In preparation for adding a new message, AnnounceSignatures2 along with
an AnnounceSignatures interface, we rename the existing message to
AnnounceSignatures1.
2024-09-18 16:13:16 +02:00
Oliver Gugger
bd84fd256e
lnwire: add custom records field to type CommitSig 2024-09-18 10:25:42 +02:00
Oliver Gugger
750770e190
Merge pull request #8981 from ProofOfKeags/refactor/payment-descriptor-quarantine
[KILO]: Quarantine paymentDescriptor to the lnwallet package
2024-09-12 09:09:02 -06:00
Oliver Gugger
fd154dd726
Merge pull request #9082 from morehouse/fuzz_reply_channel_range_fixes
lnwire: manually compare Timestamps in fuzz test
2024-09-11 05:27:09 -06:00
Matt Morehouse
c1a6d3ac31
lnwire: fail decoding on incorrect number of timestamps
Currently if an incorrect number of timestamps is given, we fail later
on in the GossipSyncer. It makes more sense to fail right away, since we
already do that for incorrect SCID formats (e.g., unsorted or duplicate
SCIDs). There is already a matching check in Encode for incorrect number
of timestamps, so adding this check to Decode makes things symmetric.
2024-09-10 14:36:30 -05:00
Matt Morehouse
475cd6e344
lnwire: manually compare Timestamps in fuzz test
We can't use require.Equal because it considers nil slices and empty
slices to be not equal.
2024-09-10 11:41:31 -05:00
Keagan McClelland
721a0c5edc
lnwire+htlcswitch: change NewInvalidBlinding to use array instead of slice 2024-09-09 16:26:41 -06:00
ffranr
8d1059f41c
lnwire: add custom records field to type UpdateFulfillHtlc
- Introduce the field `CustomRecords` to the type `UpdateFulfillHtlc`.
- Encode and decode the new field into the `ExtraData` field of the
`update_fulfill_htlc` wire message.
- Empty `ExtraData` field is set to `nil`.
2024-09-05 11:18:15 +02:00
ffranr
81f6a8060f
lnwire: add custom records field to type UpdateAddHtlc
- Introduce the field `CustomRecords` to the type `UpdateAddHtlc`.
- Encode and decode the new field into the `ExtraData` field of
  the `update_add_htlc` wire message.
2024-09-05 11:18:15 +02:00
ffranr
af50694643
lnwire: add ExtraOpaqueData helper functions and methods
Introduces a couple of new helper functions for both the ExtraOpaqueData
and CustomRecords types along with new methods on the ExtraOpaqueData.
2024-09-05 11:18:15 +02:00
ffranr
17c0a70b07
lnwire: add unit tests for ExtraOpaqueData.PackRecords 2024-09-05 10:29:42 +02:00
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