Commit graph

17327 commits

Author SHA1 Message Date
Olaoluwa Osuntokun
fef368bb38
contractcourt: set resolution blob in commitSweepResolver 2024-10-11 14:22:10 +02:00
Olaoluwa Osuntokun
080771db62
input: add ResolutionBlob method to inputKit
We also update breachedOutput w/ the new API.
2024-10-11 14:22:10 +02:00
Olaoluwa Osuntokun
fc02cd7b0c
input: refactor all inputs to use MakeBaseInput, add opts
In this commit, we refactor all the other constructors for the input to
use MakeBaseInput. We also add a new set of functional options as well.
This'll be useful later on to ensure that new options are properly
applied to all the input types.
2024-10-11 14:22:10 +02:00
Olaoluwa Osuntokun
07ee114116
lnwallet+peer: move internalKeyForAddr to lnwallet package
This way we can re-use it. We also make it slightly more generalized.
2024-10-11 14:22:10 +02:00
Olaoluwa Osuntokun
74d27f2c7c
contractcourt: add CommitBlob to taprootBriefcase
This'll be used to store the extra resolution information for the
commitment outputs.
2024-10-11 14:22:10 +02:00
Olaoluwa Osuntokun
f4710ca639
lnwallet: add new aux resolver interface
This will be used by external callers to modify the way we resolve
contracts on chain. For a given contract, we'll store an extra "blob",
that will later be presented during the sweeping phase.
2024-10-11 14:22:10 +02:00
Olaoluwa Osuntokun
900a0a114a
contractcourt: convert taprootBriefcase to use new tlv record type
This commit doesn't yet go all the way to modify all the other records
quite yet.
2024-10-11 14:22:10 +02:00
Olaoluwa Osuntokun
035126b280
lnwire: modify TestLightningWireProtocol to use sub-tests
This way, it's possible to run induvidual tests to target failures.
2024-10-11 14:22:09 +02:00
George Tsagkarelis
9d50e273a3
routing: add htlcAmt to PaymentBandwidth method of TlvTrafficShaper
This commit was added to the 0-19-staging branch recently and therefore
didn't make it into a previous part yet. So it's unrelated to the
changes in this part but is required for the whole custom channel saga.
2024-10-11 14:22:09 +02:00
Oliver Gugger
053b6bcfad
Merge branch '0-18-4-branch-rc1-9134' into 0-18-4-branch-rc1 2024-10-11 14:20:33 +02:00
Elle Mouton
663f4c251e
feature: remove b11 feature bit from default invoice set 2024-10-11 14:20:19 +02:00
Elle Mouton
6df4f27929
server: stop interceptable switch in Stop 2024-10-11 14:20:19 +02:00
Elle Mouton
575d699917
invoices: init quit channel of modifier
Also add atomic start and stop vars to prevent close of a closed
channel.
2024-10-11 14:20:19 +02:00
Elle Mouton
d2c745e610
multi: update PaymentAddr to use fn.Option
Since it is allowed to not be set and so can lead to nil deref panics if
it is a pointer.
2024-10-11 14:20:17 +02:00
Oliver Gugger
7857f38f45
Merge branch '0-18-4-branch-rc1-9095' into 0-18-4-branch-rc1 2024-10-11 14:17:28 +02:00
Oliver Gugger
9ce799578c
multi: add co-op close custom data to close update
With this commit we populate additional information about the close
outputs (including potential custom channel data) in the close update
RPC message.
This will allow custom channels to find out how the additional close
outputs look like on chain and what data they might commit to.

We also hook up the aux custom data formatter, so it can format the
custom channel data to JSON.
2024-10-11 14:17:28 +02:00
Olaoluwa Osuntokun
39e4e8d8a4
peer: decorate delivery addr w/ internal key
In this commit, we move to add the internal key to the delivery addr. This way, we give the aux chan closer the extra information it may need to properly augment the normal co-op close process.
2024-10-11 14:17:28 +02:00
Olaoluwa Osuntokun
fbbcecc635
server+peer: init peer struct w/ AuxChanCloser if present 2024-10-11 14:17:27 +02:00
Olaoluwa Osuntokun
8b97d4f833
lnwallet: modify CoopCloseBalance to not depend on chan commit 2024-10-11 14:17:27 +02:00
Olaoluwa Osuntokun
e536cfad0f
lnwallet/chancloser: add aux chan closer, use in coop flow 2024-10-11 14:17:27 +02:00
Olaoluwa Osuntokun
e2dae56698
lnwallet/chancloser: add new AuxChanCloser interface 2024-10-11 14:17:27 +02:00
Olaoluwa Osuntokun
2d8c4fda2f
lnwallet: add ability to do custom sort for coop close txn 2024-10-11 14:17:27 +02:00
Olaoluwa Osuntokun
0cb211e14c
lnwallet: add ability to add extra co-op close outputs 2024-10-11 14:17:27 +02:00
Olaoluwa Osuntokun
7e4f6f5b4a
lnwallet: add FundingBlob method to LightningChannel 2024-10-11 14:17:27 +02:00
Olaoluwa Osuntokun
6feb189a21
lnwire: add CustomRecords to shutdown message 2024-10-11 14:17:26 +02:00
ffranr
35ce62c021
itest: add basic invoice HTLC modifier integration test
This commit introduces a basic integration test for the invoice
HTLC modifier. The test covers scenarios where an invoice is settled with a
payment that is less than the invoice amount, facilitated by the invoice
HTLC modifier.
2024-10-11 14:17:26 +02:00
Oliver Gugger
0cb599dbf6
lnrpc+rpcserver: encode custom records as custom channel data
With this commit we encode the custom records as a TLV stream into the
custom channel data field of the invoice HTLC.
This allows the custom data parser to parse those records and replace it
with human-readable JSON on the RPC interface.
2024-10-11 14:17:26 +02:00
ffranr
c1aa44c476
multi: pass UpdateAddHtlc message custom records to invoice modifier 2024-10-11 14:17:26 +02:00
Oliver Gugger
109e27cfb2
lnwire: add MergedCopy method to CustomRecords 2024-10-11 14:17:26 +02:00
ffranr
ce7c053de0
lntest: add HtlcModifier support to node RPC harness
This commit enhances the itest LND node harness to include support for
the new `HtlcModifier` RPC endpoint.
At the same time we move another method to the correct file.
2024-10-11 14:17:26 +02:00
ffranr
e417250f6d
invoicesrpc: add HtlcModifier RPC endpoint and modifier RPC server
This commit introduces a singleton invoice HTLC modifier RPC server and
an endpoint to activate it. The server interfaces with the internal
invoice HTLC modifier interpreter, handling the marshalling between RPC
types and internal formats.
2024-10-11 14:17:26 +02:00
ffranr
7285dfa66a
invoicesrpc: add HTLC modifier to invoices RPC server
This commit integrates the HTLC modifier service into the
invoices RPC server.
2024-10-11 14:17:25 +02:00
ffranr
f903e16c47
lnd: initialize invoice settlement interceptor at server startup
This commit initiates the invoice settlement interceptor during the
main server startup, assigning it a handle within the server.
2024-10-11 14:17:25 +02:00
ffranr
4d9422a064
invoices: integrate settlement interceptor with invoice registry
This commit updates the invoice registry to utilize the settlement
interceptor during the invoice settlement routine. It allows the
interceptor to capture the invoice, providing interception clients an
opportunity to determine the settlement outcome.
2024-10-11 14:17:25 +02:00
ffranr
acf0d0ebe8
invoices: add invoice htlc interceptor service
This commit introduces a new invoice htlc interceptor service
that intercepts invoice HTLCs during their settlement phase. It forwards
HTLCs to a subscribed client to determine their settlement outcomes.

This commit also introduces an interface to facilitate integrating the
interceptor with other packages.
2024-10-11 14:17:25 +02:00
Oliver Gugger
153a133ea6
Merge branch '0-18-4-branch-rc1-9072' into 0-18-4-branch-rc1 2024-10-11 14:16:36 +02:00
Oliver Gugger
c3627545be
htlcswitch: override amount check on custom records 2024-10-11 14:16:36 +02:00
Oliver Gugger
b35dae72a5
channeldb: add NextHeight, fix formatting 2024-10-11 14:16:36 +02:00
Oliver Gugger
f9debb148b
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-10-11 14:16:36 +02:00
Oliver Gugger
23ef68a2f7
lnrpc+rpcserver: add and populate custom channel data 2024-10-11 14:16:36 +02:00
Jonathan Harvey-Buschel
9c80088abd
lnwallet: sort sig jobs before submission
To make sure we attempt to read the results of the sig batches in the
same order they're processed, we sort them _before_ submitting them to
the batch processor.
Otherwise it might happen that we try to read on a result channel that
was never sent on because we aborted due to an error.
We also use slices.SortFunc now which doesn't use reflection and might
be slightly faster.
2024-10-11 14:16:35 +02:00
Olaoluwa Osuntokun
69155bc60b
multi: 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-10-11 14:16:35 +02:00
Oliver Gugger
4db0d76ca4
lnwire: add custom records field to type CommitSig 2024-10-11 14:16:35 +02:00
Olaoluwa Osuntokun
b83783cc3d
lnwallet: add WithAuxSigner option to channel 2024-10-11 14:16:35 +02:00
Oliver Gugger
6d3f8af007
lnwallet: clarify usage of cancel and response channels 2024-10-11 14:16:35 +02:00
Oliver Gugger
266aba8a6c
lnwallet: allow read-only access to HtlcView's HTLCs
Due to a recent refactor, the HTLCs are no longer an exported type.
Custom channels need access to those updates, so we provide them in a
read-only manner.
2024-10-11 14:16:35 +02:00
Olaoluwa Osuntokun
6dda51d026
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-10-11 14:16:35 +02:00
Oliver Gugger
dbb87b4ef9
funding: inform aux controller about channel ready/finalize 2024-10-11 14:16:34 +02:00
Oliver Gugger
18dca6f4c8
multi: add tapscript root to gossip message 2024-10-11 14:16:34 +02:00
Olaoluwa Osuntokun
1402f087ab
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-10-11 14:16:34 +02:00