16551 Commits

Author SHA1 Message Date
ffranr
25d8cd95da
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-05-02 20:32:36 +02:00
ffranr
1f857ee950
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-05-02 20:32:35 +02:00
ffranr
fb2f9a0531
lnwire: add encoding/decoding unit tests for UpdateAddHtlc message 2024-05-02 20:32:35 +02:00
ffranr
ba043fa1d1
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-05-02 20:32:35 +02:00
ffranr
7c2d6586b8
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-05-02 20:32:35 +02:00
ffranr
267cfa2118
htlcswitch: add missing method doc 2024-05-02 20:32:35 +02:00
ffranr
9da4addbf1
multi: improve comment grammar 2024-05-02 20:32:35 +02:00
Oliver Gugger
e9f2f169e2
gissiper: only set tapscript root if optional fields available 2024-05-02 19:14:05 +02:00
Oliver Gugger
fb2a9026f3
cmd/commands: export StripPrefix 2024-05-02 14:38:13 +02:00
Oliver Gugger
3ba83dd111
funding: add ChannelReady hook 2024-05-02 10:01:07 +02:00
Olaoluwa Osuntokun
82a969bba5 multi: hook up protofsm to logging 2024-05-01 23:30:56 -05:00
Olaoluwa Osuntokun
bdfd79425b tlv: generate types for the custom message range
We generate the first 100 custom messages. For anything beyond this, a custom struct can be created.
2024-05-01 00:43:03 -05:00
Olaoluwa Osuntokun
1bac89dda7 lnwallet: copy over the HTLC extra data in commit diff 2024-05-01 00:41:43 -05:00
Olaoluwa Osuntokun
53117548de htlcswitch: properly set AuxSigBlob 2024-05-01 00:40:37 -05:00
Oliver Gugger
8d5d15904b
lnwallet: don't flip local/remote leaves 2024-04-29 21:28:05 +02:00
Oliver Gugger
0af8ce4c54
lnwallet: set NextHeight in HtlcView 2024-04-29 19:13:51 +02:00
Olaoluwa Osuntokun
9795a7856b lnwallet: add NextHeight to HtlcView 2024-04-27 18:14:17 -07:00
Olaoluwa Osuntokun
3f4fa79cf5 multi: add tapscript root to chan ann (temp)
Needed so the router can validate the musig2 output w/ a custom tweak.
2024-04-26 20:14:52 -07:00
Olaoluwa Osuntokun
2ba7a531ae record: temp disable record validation
Existing code relies on the TLV value in the HTLC being zero, which
needs to change.
2024-04-26 19:17:47 -07:00
Olaoluwa Osuntokun
d221298b56 cmd: export payment related CLI structs+funcs 2024-04-26 17:09:48 -07:00
Olaoluwa Osuntokun
7c69966cf3 fixup! routing: add first hop TLVs to ExtraData 2024-04-26 16:40:54 -07:00
Olaoluwa Osuntokun
cf80b7cd9c
routing: add first hop TLVs to ExtraData 2024-04-26 16:39:56 -07:00
George Tsagkarelis
cbdcdac213 routing: encode first hop records in update_add_htlc message 2024-04-26 16:13:31 -07:00
George Tsagkarelis
3a53b16549 lnrpc: add first hop records field to SendPayment 2024-04-26 16:13:03 -07:00
Olaoluwa Osuntokun
7a3246855f cmd: expose ChannelBalance for decoration 2024-04-25 17:17:20 -07:00
Olaoluwa Osuntokun
675931ac9a lnrpc: add custom blob to pendingchannels + channelbalance 2024-04-25 17:12:38 -07:00
Olaoluwa Osuntokun
7a99259301 rpc: encode custom chan data as two var byte blobs
The first will be the static open chan data. The second, the data of our
latest commitment transaction.
2024-04-24 19:24:58 -07:00
Oliver Gugger
cf965f04ad
lnwallet: add Tree() method, fix formatting 2024-04-24 17:04:06 +02:00
Oliver Gugger
91579829f2
lnwallet: export GenTaprootHtlcScript 2024-04-24 17:03:43 +02:00
Oliver Gugger
8f73c014ad
lnwallet: export AnchorSize 2024-04-24 17:03:20 +02:00
Oliver Gugger
95f931309e
lnwallet: add AddHeight and RemoveHeight funcs 2024-04-24 17:02:56 +02:00
Oliver Gugger
b4731b3d2d
cmd/lncli: move commands and export 2024-04-24 17:02:32 +02:00
Olaoluwa Osuntokun
1858e1966f
lnwire: modify PackRecords to prepend new records
As is, we can't use PackRecords when some data may already be stored in the ExtraData field. To allow this use case, we add a failing test, then modify `PackRecords` to append the existing raw bytes (prepend the new records).

Note that this doesn't 100% solve the problem, as for the stream to be cannonical we need unique IDs/types and also for them to be in ascending order.
2024-04-24 17:01:53 +02:00
Olaoluwa Osuntokun
c0c511c686
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-04-24 17:01:49 +02:00
Olaoluwa Osuntokun
e9e10cc32f
lnwallet: add WithAuxSigner option to channel 2024-04-24 16:59:03 +02:00
Olaoluwa Osuntokun
a6b56daef9
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-04-24 16:59:02 +02:00
Olaoluwa Osuntokun
17e9758ee7
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.
2024-04-24 16:58:58 +02:00
Olaoluwa Osuntokun
73aa617d9b
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-04-24 16:49:29 +02:00
Olaoluwa Osuntokun
63566c7614
lnwallet+input: update unit tests for compilation 2024-04-24 16:49:20 +02:00
Olaoluwa Osuntokun
036a5a946c
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-04-24 16:48:53 +02:00
Olaoluwa Osuntokun
50f0e1d03e
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-04-24 16:48:26 +02:00
Olaoluwa Osuntokun
f2ef2b4774
lnwallet: update GenTaprootFundingScript to also return the taproot internal key 2024-04-24 16:47:37 +02:00
Olaoluwa Osuntokun
c71d4fd420
config+serer: add AuxFundingController as top level cfg option 2024-04-24 16:47:24 +02:00
Olaoluwa Osuntokun
cba09680b1
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-04-24 16:47:08 +02:00
Olaoluwa Osuntokun
2ef9b377a6
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-04-24 16:46:35 +02:00
Olaoluwa Osuntokun
7d86894634
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-04-24 16:45:42 +02:00
Olaoluwa Osuntokun
b3223048de
fundign: 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-04-24 16:45:25 +02:00
Olaoluwa Osuntokun
965c7d6969
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-04-24 16:45:09 +02:00
Olaoluwa Osuntokun
c9d8adc83c
peer+protofsm: move MsgRouter to new protofsm package
Without this, any other sub-system that wants to use the interface may run into an import cycle.
2024-04-24 16:44:53 +02:00
Olaoluwa Osuntokun
b9786e1f20
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-04-24 16:44:36 +02:00