16515 Commits

Author SHA1 Message Date
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
Olaoluwa Osuntokun
d9709b8bf6
channeldb: convert HTLCEntry to use tlv.RecordT 2024-04-24 16:36:46 +02:00
Olaoluwa Osuntokun
59f73c77e5
lnwallet+channeldb: add new AuxLeafStore for dynamic aux leaves
In this commit, we add a new AuxLeafStore which can be used to dynamically fetch the latest aux leaves for a given state. This is useful for custom channel types that will store some extra information in the form of a custom blob, then will use that information to derive the new leaf tapscript leaves that may be attached to reach state.
2024-04-24 14:58:31 +02:00
Olaoluwa Osuntokun
9cc8fa4196
lnwallet: add custom tlv blob to internal commitment struct
In this commit, we also add the custom TLV blob to the internal commitment struct that we use within the in-memory commitment linked list.

This'll be useful to ensure that we're tracking the current blob for our in memory commitment for when we need to write it to disk.
2024-04-24 13:54:03 +02:00
Olaoluwa Osuntokun
b68195a6dd
lnwallet: export the HtlcView struct
We'll need this later on to ensure we can always interact with the new aux blobs at all stages of commitment transaction construction.
2024-04-24 13:48:39 +02:00
Olaoluwa Osuntokun
2a635020bc
channeldb: new custom blob nested TLV
In this commit, for each channel, we'll now start to store an optional custom blob. This can be used to store extra information for custom channels in an opauqe manner.
2024-04-24 13:43:57 +02:00
Olaoluwa Osuntokun
0b5670309e
tlv: add in new BigSizeT type
This type is useful when one wants to encode an integer as an underlying BigSize record. It wraps any integer, then handles the transformation into and out of the BigSize encoding on disk.
2024-04-24 13:40:58 +02:00
Olaoluwa Osuntokun
8a790ffd39
mod+tlv: add new Blob type alias, add go.work
In this commit, we add a new type alias for a blob type. This type can be used in areas where a byte slice is used to store a TLV value, which may be a fully opaque nested TLV.

We also commit our go.work file to ensure the changes that follow can always build.
2024-04-24 13:25:26 +02:00
Olaoluwa Osuntokun
002787f229
input+lnwallet: update taproot scripts to accept optional aux leaf
In this commit, we update all the taproot scripts to also accept an
optional aux leaf. This aux leaf can be used to add more redemption
paths for advanced channels, or just as an extra commitment space.
2024-04-24 13:25:26 +02:00
Olaoluwa Osuntokun
08a6c9c738
lnwallet: add initial unit tests for musig2+tapscript root chans 2024-04-24 11:36:03 +02:00
Olaoluwa Osuntokun
64aed86880
lnwallet+peer: add tapscript root awareness to musig2 sessions
With this commit, the channel is now aware of if it's a musig2 channel, that also has a tapscript root. We'll need to always pass in the tapscript root each time we: make the funding output, sign a new state, and also verify a new state.
2024-04-24 11:36:03 +02:00
Olaoluwa Osuntokun
4cb351b53e
lnwallet: update internal funding flow w/ tapscript root
This isn't hooked up yet to the funding manager, but with this commit, we can now start to write internal unit tests that handle musig2 channels with a tapscript root.
2024-04-24 11:36:03 +02:00
Olaoluwa Osuntokun
ebeb3afb04
multi: update GenTaprootFundingScript to pass tapscript root
In most cases, we won't yet be passing a root. The option usage helps us keep the control flow mostly unchanged.
2024-04-24 11:34:29 +02:00
Olaoluwa Osuntokun
64ec9523a0
lnwallet/chanfunding: add optional tapscript root 2024-04-24 11:34:28 +02:00
Olaoluwa Osuntokun
d2325c41c6
input: add new tapscript root func op to GenTaprootFundingScript
This'll allow us to create a funding output that uses musig2, but uses a tapscript tweak rather than a normal BIP 86 tweak.
2024-04-24 11:34:28 +02:00
Olaoluwa Osuntokun
76c5ef0df2
channeldb: add optional TapscriptRoot field + feature bit 2024-04-24 11:34:28 +02:00
Olaoluwa Osuntokun
369a6e5891
channeldb: consolidate root bucket TLVs into new struct
In this commit, we consolidate the root bucket TLVs into a new struct.
This makes it easier to see all the new TLV fields at a glance. We also
convert TLV usage to use the new type param based APis.
2024-04-24 11:34:28 +02:00
Olaoluwa Osuntokun
6f4ebe7d0a
lnwallet/chanfunding: remote assembler.go to interface.go
In this commit, we rename the files as assembler.go houses the primary
interfaces/abstractions of the package. In the rest of the codebase,
this file is near uniformly called interface.go, so we rename the file
to make the repo more digestible at a scan.
2024-04-24 10:37:22 +02:00
Oliver Gugger
7fb233326e
Merge pull request #8674 from yyforyongyu/sweeper-remove-and-docs
sweep: add docs and remove dead code
2024-04-23 11:12:24 -06:00
yyforyongyu
e855421095
docs: update release notes 2024-04-23 23:19:41 +08:00
yyforyongyu
83024585bb
sweep: add README 2024-04-23 23:17:44 +08:00
Oliver Gugger
2b74a34301
Merge pull request #8678 from hieblmi/add-hieblmi-to-verify-install
Add hieblmi to verify install script
2024-04-23 06:16:43 -06:00
Slyghtning
ffaf4da1da
release: add hieblmi to verify install script 2024-04-23 10:03:23 +02:00
yyforyongyu
9c5124e117
sweep: remove unused param Fee 2024-04-23 04:44:00 +08:00
yyforyongyu
54aaeea491
sweep: remove dead code and dead tests 2024-04-23 04:44:00 +08:00
Olaoluwa Osuntokun
7af195768a
Merge pull request #8667 from lightningnetwork/elle-new-sweeper
Merge new sweeper branch to master
2024-04-22 11:20:49 -07:00
Oliver Gugger
73fd389e9a
Merge pull request #8627 from feelancer21/inbound-fees-reject
lnrpc: rejects positive inbound fees by default
2024-04-22 01:56:02 -06:00