Commit graph

17188 commits

Author SHA1 Message Date
Oliver Gugger
23ef68a2f7
lnrpc+rpcserver: add and populate custom channel data 2024-10-11 14:16:36 +02:00
Jonathan Harvey-Buschel
9c80088abd
lnwallet: sort sig jobs before submission
To make sure we attempt to read the results of the sig batches in the
same order they're processed, we sort them _before_ submitting them to
the batch processor.
Otherwise it might happen that we try to read on a result channel that
was never sent on because we aborted due to an error.
We also use slices.SortFunc now which doesn't use reflection and might
be slightly faster.
2024-10-11 14:16:35 +02:00
Olaoluwa Osuntokun
69155bc60b
multi: obtain+verify aux sigs for all second level HTLCs
In this commit, we start to use the new AuxSigner to obtain+verify aux sigs for all second level HTLCs. This is similar to the existing SigPool, but we'll only attempt to do this if the AuxSigner is present (won't be for most channels).
2024-10-11 14:16:35 +02:00
Oliver Gugger
4db0d76ca4
lnwire: add custom records field to type CommitSig 2024-10-11 14:16:35 +02:00
Olaoluwa Osuntokun
b83783cc3d
lnwallet: add WithAuxSigner option to channel 2024-10-11 14:16:35 +02:00
Oliver Gugger
6d3f8af007
lnwallet: clarify usage of cancel and response channels 2024-10-11 14:16:35 +02:00
Oliver Gugger
266aba8a6c
lnwallet: allow read-only access to HtlcView's HTLCs
Due to a recent refactor, the HTLCs are no longer an exported type.
Custom channels need access to those updates, so we provide them in a
read-only manner.
2024-10-11 14:16:35 +02:00
Olaoluwa Osuntokun
6dda51d026
lnwallet: add new AuxSigner interface to mirror SigPool
In this commit, we add a new aux signer interface that's meant to mirror the SigPool. If present, this'll be used to (maybe) obtain signatures for second level HTLCs for certain classes of custom channels.
2024-10-11 14:16:35 +02:00
Oliver Gugger
dbb87b4ef9
funding: inform aux controller about channel ready/finalize 2024-10-11 14:16:34 +02:00
Oliver Gugger
18dca6f4c8
multi: add tapscript root to gossip message 2024-10-11 14:16:34 +02:00
Olaoluwa Osuntokun
1402f087ab
funding+lnwallet: finish hook up new aux funding flow
For the initiator, once we get the signal that the PSBT has been
finalized, we'll call into the aux funder to get the funding desc. For
the responder, once we receive the funding_created message, we'll do the
same.

We now also have local+remote aux leaves for the commitment transaction.

Some old TODO comments that in retrospect aren't required anymore are
removed as well.
2024-10-11 14:16:34 +02:00
Olaoluwa Osuntokun
f2dff16c37
funding+lnwallet: only blind tapscript root early in funding flow
In this commit, we modify the aux funding work flow slightly. We won't
be able to generate the full AuxFundingDesc until both sides has
sent+received funding params. So we'll now only attempt to bind the
tapscript root as soon as we send+recv the open_channel message.

We'll now also make sure that we pass the tapscript root all the way
down into the musig2 session creation.
2024-10-11 14:16:34 +02:00
Olaoluwa Osuntokun
39b1080166
lnwallet: for PsbtIntent return the internal key in the POutput
We also add a new assertion to the itests to ensure the field is being properly set.
2024-10-11 14:16:34 +02:00
Olaoluwa Osuntokun
0a7139c9ca
lnwallet: add TaprootInternalKey method to ShimIntent
If this is a taproot channel, then we'll return the internal key which'll be useful to callers.
2024-10-11 14:16:34 +02:00
Olaoluwa Osuntokun
723621bd2b
config+serer: add AuxFundingController as top level cfg option 2024-10-11 14:16:34 +02:00
Olaoluwa Osuntokun
7f3aff9e10
funding: create new AuxFundingController interface
In this commit, we make a new `AuxFundingController` interface capable of processing messages off the wire. In addition, we can use it to abstract away details w.r.t how we obtain a `AuxFundingDesc` for a given channel.

We'll now use this whenever we get a channel funding request, to make sure we pass along the custom state that a channel may require.
2024-10-11 14:16:33 +02:00
Olaoluwa Osuntokun
5f5bbf9ae2
lnwallet: use AuxFundingDesc to populate all custom chan info
With this commit, we'll now populate all the custom channel information within the OpenChannel and ChannelCommitment structs.
2024-10-11 14:16:33 +02:00
Olaoluwa Osuntokun
f73f5f5582
lnwallet: add new AuxFundingDesc struct
This struct will house all the information we'll need to do a class of custom channels that relies primarily on adding additional items to the tapscript root of the HTLC/commitment/funding outputs.
2024-10-11 14:16:33 +02:00
Oliver Gugger
a7534597dd
Merge branch '0-18-4-branch-rc1-8981' into 0-18-4-branch-rc1 2024-10-11 14:15:30 +02:00
Keagan McClelland
56866448dc
lnwallet: remove unnecessary chanID argument form unsignedLocalUpdates 2024-10-11 14:15:16 +02:00
Keagan McClelland
f8979c0614
htlcswitch+lnwallet: quarantine paymentDescriptor to lnwallet
The objective of this commit is to make paymentDescriptor a private
data structure so we can quarantine it to the lnwallet package.
To accomplish this we had to prevent it from leaking out via the
arguments or return values of the public functions in lnwallet.
This naturally had consequences for the htlcswitch package as we
choose other mechanisms for tracking the data that paymentDescriptor
was responsible for.

Astoundingly, this was highly successful and allowed us to remove
a ton of redundant code. The diff for this commit represents a
substantial reduction in total lines of code as well as extraneous
arguments and return values from key functions.

This also sets the stage for future commits where we actually will
be attempting to rid lnwallet of paymentDescriptor completely.
2024-10-11 14:15:14 +02:00
Keagan McClelland
7e5f6b5802
lnwallet: remove unused function PayDescsFromRemoteLogUpdates
This function is no longer used as of the last commit and it is the
last remaining leak of the PaymentDescriptor type through the public
API.
2024-10-11 14:14:41 +02:00
Keagan McClelland
addf9e8dbe
htlcswitch: remove PaymentDescriptor conversion from reforwardSettleFails
This is part of a systematic removal of PaymentDescriptor from the mechanics
of the htlcswitch package.
2024-10-11 14:14:41 +02:00
Keagan McClelland
870800b81a
htlcswitch+lnwallet: remove PaymentDescriptor from ReceiveRevocation returns
This is part of a systematic removal of PaymentDescriptor from the public
API of the lnwallet package. This marks the last change needed before we
make the PaymentDescriptor structure private.
2024-10-11 14:14:41 +02:00
Keagan McClelland
a3e127d1d6
htlcswitch: remove PaymentDescriptor from processRemoteSettleFails call signature
This is part of a systematic removal of PaymentDescriptor from the mechanics
of the htlcswitch package.
2024-10-11 14:14:41 +02:00
Keagan McClelland
875d2e4664
htlcswitch: remove PaymentDescriptor from processRemoteAdds call signature
This is part of a systematic removal of PaymentDescriptor from the mechanics
of the htlcswitch package.
2024-10-11 14:14:41 +02:00
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