16541 Commits

Author SHA1 Message Date
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
Olaoluwa Osuntokun
6eab09c2a0
peer: update Start/Stop w/ awareness of msg router 2024-04-24 16:44:20 +02:00
Olaoluwa Osuntokun
fbbd8df487
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-04-24 16:44:05 +02:00
Olaoluwa Osuntokun
ba6f01d48b
peer: 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-04-24 16:43:49 +02:00
Olaoluwa Osuntokun
9f4677d197
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.

Given the aux leaf store, and a struct that describes the current commitment, we can obtain the CommitAuxLeaves struct, then use that to derive the aux leaves for the commitment outputs and also HTLCs as well.

When restoring commitments and pay descs from disk, we'll store the aux leaves as custom TLV blobs on disk, then use the aux leaf store to map back to the concrete aux leaves when needed.
2024-04-24 16:43:41 +02:00
Olaoluwa Osuntokun
b199e9b783
lnwallet: add incoming+outgoing aux leaves to CommitAuxLeaves
In addition to the leaves for the commitment outputs, we'll also need to interact with leaves for all the HTLC outputs as well.
2024-04-24 16:43:14 +02:00
Olaoluwa Osuntokun
6d831eafa3
lnwallet: add TLV blob to PaymentDescriptor + htlc add
In this commit, we add a TLV blob to the PaymentDescriptor struct. We also now thread through this value from the UpdateAddHTLC message to the PaymentDescriptor mapping, and the other way around.
2024-04-24 16:43:11 +02:00
Olaoluwa Osuntokun
f48664420f
input: add some utility type definitions for aux leaves
In this commit, we add some useful type definitions for the aux leaf, and a helper function to cut down on some line noise.
2024-04-24 16:39:41 +02:00
Olaoluwa Osuntokun
c79648e4e1
channeldb: add HtlcIndex to HTLCEntry
This may be useful for custom channel types that base everything off the index (a global value) rather than the output index (can change with each state).
2024-04-24 16:39:11 +02:00
Olaoluwa Osuntokun
ceaab9f99f
channeldb: add custom blobs to RevocationLog+HTLCEntry
This'll be useful for custom channel types that want to store extra information that'll be useful to help handle channel revocation cases.
2024-04-24 16:39:07 +02:00
Olaoluwa Osuntokun
9d1926b7f1
channeldb: convert RevocationLog to use RecordT 2024-04-24 16:37:57 +02:00