Commit Graph

16552 Commits

Author SHA1 Message Date
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
Oliver Gugger
a201d5e365 Merge pull request #8661 from ProofOfKeags/feature/record-producer-axiom
tlv: add axiomatic RecordProducer implementation for Record
tlv/v1.2.4
2024-04-22 01:42:06 -06:00
feelancer21
a2319e4313 lnrpc: rejects positive inbound fees by default
Positive inbound are now rejected by default. The user can enable positive
inbound fees with the option 'accept-positive-inbound-fees'.
2024-04-20 00:11:36 +02:00
yyforyongyu
4d96f9c4c1 docs: add release notes 2024-04-20 04:41:31 +08:00
yyforyongyu
d854c80aa7 itest+lntest: fix itest re the new sweeping behavior 2024-04-20 04:41:29 +08:00
yyforyongyu
e0f0f5c6a9 sweep: skip wallet inputs in isThirdPartySpent 2024-04-19 21:33:40 +08:00
yyforyongyu
a50cdd64c5 sweep: assign deadline values to inputs in handleNewInput
This commit changes how we transform from a deadline option to a
concrete deadline value - previously this is done when we decide to
cluster inputs, and we now move it to a step earlier - once an input is
received via `SweeperInput`, we will immediately transform its optional
deadline into a real value. For inputs that come with a deadline option,
since the Some will be used, it makes no difference. For inputs with
None as their deadlines, we need this change to make sure the default
deadlines are assigned accurately.
2024-04-19 21:33:39 +08:00
yyforyongyu
96883f307c itest+sweep: add itest testSweepCommitOutputAndAnchor
This commit adds a test case to check the no deadline sweeping behavior.
The sweeper is updated to make sure it can handle the case for neutrino
backend.
2024-04-19 21:33:39 +08:00
yyforyongyu
f5a321d0d3 contractcourt: remove unused param to please linter 2024-04-19 21:33:39 +08:00
yyforyongyu
871cab4bc0 sweep: make sure inputs with different locktime values are not grouped 2024-04-19 21:33:39 +08:00
yyforyongyu
49cfb91af1 contractcourt: make sure sweep happens immediately on startup
This commit makes sure the time-sensitive outputs are swept immediately
during startup.
2024-04-19 21:33:39 +08:00
yyforyongyu
7abefa7760 cmd: update bumpfee, bumpclosefee and bumpforceclosefee 2024-04-19 21:33:38 +08:00
yyforyongyu
6f55a7af05 itest: add new test to check BumpFee and PendingSweeps 2024-04-19 21:33:38 +08:00
yyforyongyu
11a276e222 walletrpc+sweep: update PendingSweeps to return the new params 2024-04-19 21:33:38 +08:00