Commit graph

17312 commits

Author SHA1 Message Date
Keagan McClelland
dd9568b648
htlcswitch: remove PaymentDescriptor from hodlHtlc
This is part of a systematic removal of PaymentDescriptor from the
mechanics of the htlcswitch package.
2024-10-11 14:14:40 +02:00
Keagan McClelland
e7d545fb0a
htlcswitch: remove PaymentDescriptor from the processExitHop's call signature
This is part of a systematic removal of PaymentDescriptor from the mechanics
of the htlcswitch package.
2024-10-11 14:14:40 +02:00
Keagan McClelland
160747cf5e
htlcswitch: remove PaymentDescriptor from settleHTLC's call signature
This is done as part of a systematic removal of PaymentDescriptor from
the mechanics of the htlcswitch package.
2024-10-11 14:14:40 +02:00
Keagan McClelland
22b2568f22
htlcswitch: remove PaymentDescriptor from sendHTLCError's call signature
This is done as part of a systematic removal of PaymentDescriptor from
the mechanics of the htlcswitch package.
2024-10-11 14:14:40 +02:00
Keagan McClelland
7f2fe2e5ff
channeldb: add convenience functions for generating Source/Dest Refs 2024-10-11 14:14:40 +02:00
Keagan McClelland
d364b9b9f8
lnwallet: add function to convert paymentDescriptor to LogUpdate
Here we add a function that is capable of recovering LogUpdates from
paymentDescriptors and we refactor the lnwallet code to use this
rather than doing JIT inline construction of the LogUpdates.
2024-10-11 14:14:40 +02:00
Keagan McClelland
9904af5d96
lnwire+htlcswitch: change NewInvalidBlinding to use array instead of slice 2024-10-11 14:14:40 +02:00
Keagan McClelland
e4497b4f45
htlcswitch: change sendMalformedHTLCError to take array instead of slice 2024-10-11 14:14:39 +02:00
Keagan McClelland
fb841b6436
htlcswitch+lnwallet: fix OnionBlob to 1366 bytes 2024-10-11 14:14:39 +02:00
Keagan McClelland
391370de20
lnwallet: track ChannelID on PaymentDescriptor
In this commit we track the ChannelID on the PaymentDescriptor.
This will be useful in upcoming commits that need to be able to
reconstruct lnwire.Message values from PaymentDescriptors as the
Messages that are exchanged to update channel state all include
the ChannelID.
2024-10-11 14:14:39 +02:00
Keagan McClelland
a40d363936
lnwallet: add ChannelID method to LightningChannel
In this commit we introduce a convenience method to LightningChannel
to allow us to quickly grab the channel id. This will be important
in upcoming commits where we need to remember the ChannelID to
reconstruct update messages.
2024-10-11 14:14:39 +02:00
Oliver Gugger
8cb8f589ee
Merge branch '0-18-4-branch-rc1-9049' into 0-18-4-branch-rc1 2024-10-11 14:13:49 +02:00
George Tsagkarelis
b0be0adcef
itest: add interceptor and first hop data tests 2024-10-11 14:13:49 +02:00
Oliver Gugger
1822b2f79a
lnrpc: add first hop custom data to route 2024-10-11 14:13:48 +02:00
George Tsagkarelis
444ef199a6
routing: use first hop records on path finding 2024-10-11 14:13:48 +02:00
Oliver Gugger
5489b06628
channeldb+routing: persist first hop custom data for route 2024-10-11 14:13:48 +02:00
George Tsagkarelis
6ac750955f
lnd: use impl cfg TlvTrafficShaper 2024-10-11 14:13:48 +02:00
Olaoluwa Osuntokun
ec2b2c6e1e
routing: skip amtInRange for custom HTLCs
We might be trying to send an invoice amount that's greater than the size of the channel, but once you factor in the custom channel logic, an actual HTLC can be sent over the channel to pay that larger payment.

As a result, we'll skip over this check if a have a custom HTLC.
2024-10-11 14:13:48 +02:00
George Tsagkarelis
f927563049
routing: add TlvTrafficShaper to bandwidth hints 2024-10-11 14:13:48 +02:00
George Tsagkarelis
69430ce042
htlcswitch: expose custom channel blob from link 2024-10-11 14:13:48 +02:00
George Tsagkarelis
c70832a823
lnwallet: expose commitment blob from channel 2024-10-11 14:13:47 +02:00
Oliver Gugger
0403b97a87
lnrpc: add first hop custom records to RPC payment info 2024-10-11 14:13:47 +02:00
Oliver Gugger
ff1a45549e
channeldb+routing: persist first hop custom records
With this commit we make sure the first hop custom records aren't lost
on restart/resume of a payment, so we persist it as part of the
PaymentCreationInfo struct.
2024-10-11 14:13:47 +02:00
George Tsagkarelis
857a16d838
lnrpc: add wire records fields to payment+interceptor RPCs 2024-10-11 14:13:47 +02:00
George Tsagkarelis
ef2c9801fb
multi: use wire records on payment and intercept flows 2024-10-11 14:13:47 +02:00
Oliver Gugger
b5efc0ef3e
lnwallet: extract diskCommit, remove unused error return value 2024-10-11 14:13:47 +02:00
ffranr
1b28f47c1d
itest: add itest for field modification HTLC interception response
Implement an integration test where an HTLC is intercepted and the
interception response modifies fields in the resultant p2p message.
2024-10-11 14:13:47 +02:00
ffranr
533b9f2d45
routerrpc: extend HTLC forward interceptor resp with modification fields
This commit extends the forward HTLC intercept response with fields that
can be used in conjunction with a `ResumeModified` action to modify the
intercepted HTLC p2p message.
2024-10-11 14:13:46 +02:00
ffranr
49db662b82
htlcswitch: add resume modified HTLC action to switch
Introduce `ResumeModified` action to resume standard behavior of a p2p
message with optional modifications as specified by the client during
interception.
2024-10-11 14:13:46 +02:00
ffranr
cb15297853
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-10-11 14:13:46 +02:00
ffranr
2cfa89c719
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-10-11 14:13:46 +02:00
ffranr
ed69bb8757
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-10-11 14:13:46 +02:00
ffranr
b07e857aef
lnwire: add unit tests for ExtraOpaqueData.PackRecords 2024-10-11 14:13:46 +02:00
George Tsagkarelis
08ca28773c
itest: add dynamic scid alias routing test 2024-10-11 14:13:46 +02:00
George Tsagkarelis
d6ef2a122f
routerrpc: add XAddLocalChanAliases & XDeleteLocalChanAliases 2024-10-11 14:13:45 +02:00
Oliver Gugger
2b1f347f98
aliasmgr: export alias start and end ranges
Because we restrict custom SCID aliases to be in a specific range, we
export the range start and end values so a user of the RPCs we're going
to add in the next commits can adjust their values to fit within the
range.
2024-10-11 14:13:45 +02:00
Oliver Gugger
148ba49530
aliasmgr: avoid collision when requesting alias
With the new RPC calls that we are going to add in the next commits, it
will be possible for users to add (local only, non-gossipped) SCID
aliases for channels. Since those will be in the same range as the ones
given out by RequestAlias, we need to make sure that when we generate a
new one that it doesn't collide with an already existing one.
2024-10-11 14:13:45 +02:00
Oliver Gugger
4757e891a2
aliasmgr: add map type alias 2024-10-11 14:13:45 +02:00
George Tsagkarelis
4ef68512a9
multi: refresh htlcswitch aliases on aliasmgr update 2024-10-11 14:13:45 +02:00
George Tsagkarelis
0c95dc2118
aliasmgr: add delete local alias method 2024-10-11 14:13:45 +02:00
Oliver Gugger
2da56bd776
Merge branch '0-18-4-branch-rc1-9044' into 0-18-4-branch-rc1 2024-10-11 14:13:12 +02:00
Keagan McClelland
d4a4233e96
lnwallet+htlcswitch: define expanded NumPendingUpdates
This commit squashes the below operations for a net result where
we have an expanded capability of assessing pending updates. This
is made possible by packing the components into Duals in the prior
commits. We squash the operations to simplify review.

htlcswitch+lnwallet: rename PendingLocalUpdateCount

lnwallet: complete pending update queries API for LightningChannel

lnwallet+htlcswitch: consolidate NumPendingUpdates using ChannelParty

This commit makes the observation that we can cleanly define the
NumPendingUpdates function using a single expression by taking
advantage of the relevant fields being properly packed into Duals.
2024-10-11 14:12:54 +02:00
Keagan McClelland
b337213fb2
lnwallet: pack commitment message indices into Dual
This is yet another commit that packs a symmetric structure into
a Dual. This is the last one needed for the time being to consolidate
Num{X}UpdatesPendingOn{Y} functions into a single one.
2024-10-11 14:12:53 +02:00
Keagan McClelland
214dac0c45
lnwallet: pack update logs into Dual
This commit, like the last one packs the update logs into a symmetric
Dual structure. This will allow us to index into them more concisely
in higher order logic.
2024-10-11 14:12:52 +02:00
Keagan McClelland
61383f1014
lnwallet: pack commit chains into Dual
This commit packs the LightningChannel's localCommitmentChain and
remoteCommitmentChain into a Dual structure for better symmetric
access. This will be leveraged by an upcoming commit where we want
to more concisely express how we compute the number of pending
updates.
2024-10-11 14:12:28 +02:00
Keagan McClelland
89a94e9ac8
htlcswitch: extract error handling for syncChanStates 2024-10-11 14:12:27 +02:00
Oliver Gugger
767a6f99a5
Merge branch '0-18-4-branch-rc1-9030' into 0-18-4-branch-rc1 2024-10-11 14:11:58 +02:00
Oliver Gugger
b0728647c9
lnwallet: thread thru input.AuxTapleaf to all relevant areas
In this commit, we start to thread thru the new aux tap leaf structures to all relevant areas. This includes: commitment outputs, resolution creation, breach handling, and also HTLC scripts.
2024-10-11 14:11:58 +02:00
Oliver Gugger
860cacb70a
lnwallet: refactor commit keys to use lntypes.Dual 2024-10-11 14:11:58 +02:00
Oliver Gugger
b1c8a836e3
multi: thread thru the AuxLeafStore everywhere 2024-10-11 14:11:58 +02:00