Commit graph

16565 commits

Author SHA1 Message Date
Oliver Gugger
d2d50649ce
lnwallet: add HTLC index to commitment sorting function
To avoid sorting issues with identical HTLCs (equal size, equal payment
hash, equal CLTV), we need to also use the HTLC index to be able to
distinguish between them.
2024-05-27 18:19:47 +02:00
Oliver Gugger
a62600799e
htlcswitch+channeldb+lnwallet: fix CustomRecord decoding
It doesn't make sense to do multiple encode/decode round trips on the
custom data of an HTLC. So we just use the same custom record type
everywhere, which also simplifies some of the code again.
2024-05-27 18:19:47 +02:00
Oliver Gugger
f59c0c12cf
channeldb: add NextHeight, fix formatting 2024-05-27 18:19:45 +02:00
Oliver Gugger
b2d41ee4aa
server: fix logging of pubkey 2024-05-27 18:19:41 +02:00
Oliver Gugger
2ef42c6c51
lntest: fix comments 2024-05-27 15:53:11 +02:00
Oliver Gugger
a780c81340
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-05-27 15:53:11 +02:00
Oliver Gugger
1b3f386979
lnrpc+rpcserver: add and populate custom channel data 2024-05-27 15:53:11 +02:00
Oliver Gugger
8a0222c347
cmd/commands: export StripPrefix 2024-05-27 15:53:11 +02:00
Oliver Gugger
c25b04fbea
lnwallet: add Tree() method, fix formatting 2024-05-27 15:53:10 +02:00
Oliver Gugger
1552a67f3f
lnwallet: export GenTaprootHtlcScript 2024-05-27 15:53:10 +02:00
Oliver Gugger
74ba9e9e4d
lnwallet: export AnchorSize 2024-05-27 15:53:10 +02:00
Oliver Gugger
1f3f954a02
lnwallet: add AddHeight and RemoveHeight funcs 2024-05-27 15:53:10 +02:00
Oliver Gugger
26e759423b
cmd/lncli: move commands and export
We want to export some of our CLI code to re-use in other projects. But
in Golang you cannot import code from a `main` package.
So we need to move the actual code into its own package and only have
the `func main()` in the `main` package.
2024-05-27 15:53:10 +02:00
Oliver Gugger
626a1b87fa
Merge pull request #8632 from lightningnetwork/aux-leaf-signing
[4/5]: lnwallet: add new AuxSigner interface to mirror SigPool
2024-05-27 15:46:24 +02:00
Oliver Gugger
652ff81461
Merge pull request #8622 from lightningnetwork/aux-funding
[3/5]: multi: add new AuxFundingController for custom external funding flows
2024-05-27 15:26:13 +02:00
Olaoluwa Osuntokun
ebf9856fac
lnwallet: 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-05-27 13:02:16 +02:00
Olaoluwa Osuntokun
9b869f95bf
lnwallet: add WithAuxSigner option to channel 2024-05-27 13:02:16 +02:00
Olaoluwa Osuntokun
d908e8c2f7
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-05-27 13:02:16 +02:00
Oliver Gugger
a350ccd791
funding: inform aux controller about channel ready/finalize 2024-05-27 12:58:29 +02:00
Oliver Gugger
6b7849950a
multi: add tapscript root to gossip message 2024-05-27 12:58:29 +02:00
Olaoluwa Osuntokun
bf307d30d1
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-05-27 12:58:29 +02:00
Olaoluwa Osuntokun
26ab75852b
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-05-27 12:58:29 +02:00
Olaoluwa Osuntokun
28cb4884ca
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-05-27 12:58:28 +02:00
Olaoluwa Osuntokun
a841a9be30
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-05-27 12:58:28 +02:00
Olaoluwa Osuntokun
bb71c496f4
config+serer: add AuxFundingController as top level cfg option 2024-05-27 12:58:28 +02:00
Olaoluwa Osuntokun
2f6e7ef191
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-05-27 12:58:28 +02:00
Olaoluwa Osuntokun
54bbc25d9a
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-05-22 18:24:52 +02:00
Olaoluwa Osuntokun
f2c2a82744
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-05-22 18:24:52 +02:00
Olaoluwa Osuntokun
dd357fb847
funding: use atomic.Uint64 for chanIDNonce
This lets us get rid of the mutex usage there. We also shift the algo slightly to increment by 1, then use that as the next value, which plays nicer with the atomics.
2024-05-22 18:24:52 +02:00
Olaoluwa Osuntokun
8ba3f3a317
funding: add new type alias for PendingChanID = [32]byte
This'll be useful for new interface definitions that use the contents of the package.
2024-05-22 18:24:51 +02:00
Olaoluwa Osuntokun
5866287aae
multi: make MsgRouter available in the ImplementationCfg
With this commit, we allow the `MsgRouter` to be available in the `ImplementationCfg`. With this, programs outside of lnd itself are able to now hook into the message processing flow to direct handle custom messages, and even normal wire messages.
2024-05-22 18:24:51 +02:00
Olaoluwa Osuntokun
371e0148dc
peer: update readHandler to dispatch to msgRouter if set
Over time with this, we should be able to significantly reduce the size
of the peer.Brontide struct as we only need all those deps as the peer
needs to recognize and handle each incoming wire message itself.
2024-05-22 18:24:51 +02:00
Olaoluwa Osuntokun
e5e5da381d
log+protofsm: add new abstract message router
In this commit, we add a new abstract message router. Over time, the
goal is that this message router replaces the logic we currently have in
the readHandler (the giant switch for each message).

With this new abstraction, can reduce the responsibilities of the
readHandler to *just* reading messages off the wire and handing them off
to the msg router. The readHandler no longer needs to know *where* the
messages should go, or how they should be dispatched.

This will be used in tandem with the new `protofsm` module in an
upcoming PR implementing the new rbf-coop close.
2024-05-22 18:24:51 +02:00
Oliver Gugger
5d53431f59
Merge pull request #8665 from GeorgeTsagk/custom-sender-bandwidth-hint
routing: add TlvTrafficShaper to bandwidth hints
2024-05-22 18:24:08 +02:00
George Tsagkarelis
53e9f288ed
routing: use first hop records on path finding 2024-05-22 17:28:22 +02:00
George Tsagkarelis
a584b7585d
lnd: use impl cfg TlvTrafficShaper 2024-05-22 17:28:22 +02:00
George Tsagkarelis
37cbfea912
routing: add TlvTrafficShaper to bandwidth hints 2024-05-22 17:28:22 +02:00
George Tsagkarelis
ec7dc031c9
htlcswitch: expose custom channel blob from link 2024-05-22 17:28:22 +02:00
George Tsagkarelis
3c6d49775e
lnwallet: expose commitment blob from channel 2024-05-22 17:28:21 +02:00
Oliver Gugger
966f41f0c7
Merge pull request #8660 from GeorgeTsagk/interceptor-wire-records
Enhance `update_add_htlc` with remote peer's custom records
2024-05-22 17:27:50 +02:00
George Tsagkarelis
1b1969b9a3
itest: add interceptor wire records access test 2024-05-22 14:56:43 +02:00
George Tsagkarelis
a5fcf33082
lnrpc: add wire records fields to SendPayment & HtlcInterceptor 2024-05-22 14:45:43 +02:00
George Tsagkarelis
25b4066b17
multi: use wire records on payment and intercept flows 2024-05-22 14:44:18 +02:00
Oliver Gugger
b009db329f
Merge pull request #8509 from GeorgeTsagk/scid-alias-rpcs
Add more RPCs for scid aliases
2024-05-20 20:05:39 +02:00
George Tsagkarelis
d9a59c67c3
docs: update release notes 2024-05-20 18:50:36 +02:00
George Tsagkarelis
49f7207576
itest: add dynamic scid alias routing test 2024-05-20 18:50:36 +02:00
George Tsagkarelis
7ace55582b
aliasmgr: add alias lifecycle test 2024-05-20 18:50:36 +02:00
George Tsagkarelis
9d90485eeb
routerrpc: add XAddLocalChanAliases & XDeleteLocalChanAliases 2024-05-20 18:50:36 +02:00
George Tsagkarelis
5c1b568d3d
multi: refresh htlcswitch aliases on aliasmgr update 2024-05-20 18:50:36 +02:00
George Tsagkarelis
cc12fb3204
aliasmgr: add delete local alias method 2024-05-20 12:03:43 +02:00