Commit Graph

17288 Commits

Author SHA1 Message Date
ffranr
008d265cdb
invoicesrpc: add HTLC modifier to invoices RPC server
This commit integrates the HTLC modifier service into the
invoices RPC server.
2024-09-19 09:21:37 +02:00
ffranr
481dfe21bc
lnd: initialize invoice settlement interceptor at server startup
This commit initiates the invoice settlement interceptor during the
main server startup, assigning it a handle within the server.
2024-09-19 09:21:37 +02:00
ffranr
c58b6a25a2
invoices: integrate settlement interceptor with invoice registry
This commit updates the invoice registry to utilize the settlement
interceptor during the invoice settlement routine. It allows the
interceptor to capture the invoice, providing interception clients an
opportunity to determine the settlement outcome.
2024-09-19 09:21:37 +02:00
ffranr
b8c8774b5d
invoices: add invoice htlc interceptor service
This commit introduces a new invoice htlc interceptor service
that intercepts invoice HTLCs during their settlement phase. It forwards
HTLCs to a subscribed client to determine their settlement outcomes.

This commit also introduces an interface to facilitate integrating the
interceptor with other packages.
2024-09-19 09:21:36 +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
Olaoluwa Osuntokun
13a7becb91
Merge pull request #8044 from ellemouton/g175Messages
[1/7] lnwire: add new Gossip 1.75 messages
2024-09-18 16:05:38 -07:00
Oliver Gugger
52e50d807d
htlcswitch: override amount check on custom records 2024-09-18 19:07:27 +02:00
Oliver Gugger
cdc3a4a6c6
channeldb: add NextHeight, fix formatting 2024-09-18 19:07:27 +02:00
Oliver Gugger
d49da574e3
lnd: add aux data parser
This commit adds an optional data parser that can inspect and in-place
format custom data of certain RPC messages.
We don't add an implementation of the interface itself, as that will be
provided by external components when packaging up lnd as a bundle with
other software.
2024-09-18 19:07:27 +02:00
Oliver Gugger
5e1a98cd43
lnrpc+rpcserver: add and populate custom channel data 2024-09-18 19:07:26 +02:00
Jonathan Harvey-Buschel
ea83300942
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-09-18 19:07:26 +02:00
Olaoluwa Osuntokun
83fdbda2fa
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-09-18 19:04:53 +02:00
Elle Mouton
077273e66e
docs: update release notes 2024-09-18 16:20:28 +02:00
Elle Mouton
a62201b61d
netann: add chan update 2 validate and verify funcs 2024-09-18 16:20:28 +02: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
21c9ef8904
netann: validation and verification funcs for ChannelAnnouncement2 2024-09-18 16:14:59 +02:00
Elle Mouton
5fc1da3abe
netann: add MsgHash helper
This commit adds the MsgHash helper function which can be used to
calculate the digest of a message to be signed using schnorr signatures.
2024-09-18 16:14:59 +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
ced88a9978
netann: let ChannelUpdate validate methods take in the new interface 2024-09-18 16:14:58 +02:00
Elle Mouton
35d0c61c12
netann: let ValidateChannelAnn take the new 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
7bbf89625f
multi: move ChannelUpdate validate methods to netann 2024-09-18 16:13:18 +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
615db1fc2e
multi: move channel announcement validation to netann
from the graph package.
2024-09-18 16:13:17 +02:00
Elle Mouton
a6bf76a0b7
discovery+lnwallet: add fetchPKScript helper to gossiper
This commit makes an lnwallet.BlockChainIO available to the gossiper and
uses it to construct a helper that can be used to fetch the pk script
for a given SCID. This will be used for channel announcement
verification in an upcoming commit.
2024-09-18 16:13:17 +02:00
Elle Mouton
9be84c1bdc
graph+lnwallet: move FetchTx logic to lnwallet
So that it can be re-used elsewhere.
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
838a32d13c
Merge pull request #9116 from xixishidibei/master
bug: fix incorrect parameters in test cases
2024-09-18 04:04:28 -06:00
Oliver Gugger
bd84fd256e
lnwire: add custom records field to type CommitSig 2024-09-18 10:25:42 +02:00
Olaoluwa Osuntokun
1e85c5054e
lnwallet: add WithAuxSigner option to channel 2024-09-18 10:25:42 +02:00
Oliver Gugger
f52a163334
lnwallet: clarify usage of cancel and response channels 2024-09-18 10:25:42 +02:00
Oliver Gugger
953fb073d4
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-09-18 10:25:42 +02:00
Olaoluwa Osuntokun
aa0c680e18
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-09-18 10:25:42 +02:00
Oliver Gugger
0b64b80642
funding: inform aux controller about channel ready/finalize 2024-09-18 10:25:41 +02:00
Oliver Gugger
5c854a2f53
multi: add tapscript root to gossip message 2024-09-18 10:25:41 +02:00
Olaoluwa Osuntokun
bcb66585d4
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-09-18 10:25:41 +02:00
Olaoluwa Osuntokun
7ec48a5054
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-09-18 10:25:41 +02:00
Olaoluwa Osuntokun
bed4562584
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-09-18 10:25:41 +02:00
Olaoluwa Osuntokun
7144a1c733
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-09-18 10:25:41 +02:00
Olaoluwa Osuntokun
65f54cb075
config+serer: add AuxFundingController as top level cfg option 2024-09-18 10:25:40 +02:00
Olaoluwa Osuntokun
84cc9a1f0b
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-09-18 10:25:40 +02:00
Olaoluwa Osuntokun
72beb7955d
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-09-18 10:25:40 +02:00
Olaoluwa Osuntokun
116a6430f0
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-09-18 10:25:40 +02:00