Commit graph

17142 commits

Author SHA1 Message Date
George Tsagkarelis
c70832a823
lnwallet: expose commitment blob from channel 2024-10-11 14:13:47 +02:00
Oliver Gugger
0403b97a87
lnrpc: add first hop custom records to RPC payment info 2024-10-11 14:13:47 +02:00
Oliver Gugger
ff1a45549e
channeldb+routing: persist first hop custom records
With this commit we make sure the first hop custom records aren't lost
on restart/resume of a payment, so we persist it as part of the
PaymentCreationInfo struct.
2024-10-11 14:13:47 +02:00
George Tsagkarelis
857a16d838
lnrpc: add wire records fields to payment+interceptor RPCs 2024-10-11 14:13:47 +02:00
George Tsagkarelis
ef2c9801fb
multi: use wire records on payment and intercept flows 2024-10-11 14:13:47 +02:00
Oliver Gugger
b5efc0ef3e
lnwallet: extract diskCommit, remove unused error return value 2024-10-11 14:13:47 +02:00
ffranr
1b28f47c1d
itest: add itest for field modification HTLC interception response
Implement an integration test where an HTLC is intercepted and the
interception response modifies fields in the resultant p2p message.
2024-10-11 14:13:47 +02:00
ffranr
533b9f2d45
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-10-11 14:13:46 +02:00
ffranr
49db662b82
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-10-11 14:13:46 +02:00
ffranr
cb15297853
lnwire: add custom records field to type UpdateFulfillHtlc
- Introduce the field `CustomRecords` to the type `UpdateFulfillHtlc`.
- Encode and decode the new field into the `ExtraData` field of the
`update_fulfill_htlc` wire message.
- Empty `ExtraData` field is set to `nil`.
2024-10-11 14:13:46 +02:00
ffranr
2cfa89c719
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-10-11 14:13:46 +02:00
ffranr
ed69bb8757
lnwire: add ExtraOpaqueData helper functions and methods
Introduces a couple of new helper functions for both the ExtraOpaqueData
and CustomRecords types along with new methods on the ExtraOpaqueData.
2024-10-11 14:13:46 +02:00
ffranr
b07e857aef
lnwire: add unit tests for ExtraOpaqueData.PackRecords 2024-10-11 14:13:46 +02:00
George Tsagkarelis
08ca28773c
itest: add dynamic scid alias routing test 2024-10-11 14:13:46 +02:00
George Tsagkarelis
d6ef2a122f
routerrpc: add XAddLocalChanAliases & XDeleteLocalChanAliases 2024-10-11 14:13:45 +02:00
Oliver Gugger
2b1f347f98
aliasmgr: export alias start and end ranges
Because we restrict custom SCID aliases to be in a specific range, we
export the range start and end values so a user of the RPCs we're going
to add in the next commits can adjust their values to fit within the
range.
2024-10-11 14:13:45 +02:00
Oliver Gugger
148ba49530
aliasmgr: avoid collision when requesting alias
With the new RPC calls that we are going to add in the next commits, it
will be possible for users to add (local only, non-gossipped) SCID
aliases for channels. Since those will be in the same range as the ones
given out by RequestAlias, we need to make sure that when we generate a
new one that it doesn't collide with an already existing one.
2024-10-11 14:13:45 +02:00
Oliver Gugger
4757e891a2
aliasmgr: add map type alias 2024-10-11 14:13:45 +02:00
George Tsagkarelis
4ef68512a9
multi: refresh htlcswitch aliases on aliasmgr update 2024-10-11 14:13:45 +02:00
George Tsagkarelis
0c95dc2118
aliasmgr: add delete local alias method 2024-10-11 14:13:45 +02:00
Oliver Gugger
2da56bd776
Merge branch '0-18-4-branch-rc1-9044' into 0-18-4-branch-rc1 2024-10-11 14:13:12 +02:00
Keagan McClelland
d4a4233e96
lnwallet+htlcswitch: define expanded NumPendingUpdates
This commit squashes the below operations for a net result where
we have an expanded capability of assessing pending updates. This
is made possible by packing the components into Duals in the prior
commits. We squash the operations to simplify review.

htlcswitch+lnwallet: rename PendingLocalUpdateCount

lnwallet: complete pending update queries API for LightningChannel

lnwallet+htlcswitch: consolidate NumPendingUpdates using ChannelParty

This commit makes the observation that we can cleanly define the
NumPendingUpdates function using a single expression by taking
advantage of the relevant fields being properly packed into Duals.
2024-10-11 14:12:54 +02:00
Keagan McClelland
b337213fb2
lnwallet: pack commitment message indices into Dual
This is yet another commit that packs a symmetric structure into
a Dual. This is the last one needed for the time being to consolidate
Num{X}UpdatesPendingOn{Y} functions into a single one.
2024-10-11 14:12:53 +02:00
Keagan McClelland
214dac0c45
lnwallet: pack update logs into Dual
This commit, like the last one packs the update logs into a symmetric
Dual structure. This will allow us to index into them more concisely
in higher order logic.
2024-10-11 14:12:52 +02:00
Keagan McClelland
61383f1014
lnwallet: pack commit chains into Dual
This commit packs the LightningChannel's localCommitmentChain and
remoteCommitmentChain into a Dual structure for better symmetric
access. This will be leveraged by an upcoming commit where we want
to more concisely express how we compute the number of pending
updates.
2024-10-11 14:12:28 +02:00
Keagan McClelland
89a94e9ac8
htlcswitch: extract error handling for syncChanStates 2024-10-11 14:12:27 +02:00
Oliver Gugger
767a6f99a5
Merge branch '0-18-4-branch-rc1-9030' into 0-18-4-branch-rc1 2024-10-11 14:11:58 +02:00
Oliver Gugger
b0728647c9
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.
2024-10-11 14:11:58 +02:00
Oliver Gugger
860cacb70a
lnwallet: refactor commit keys to use lntypes.Dual 2024-10-11 14:11:58 +02:00
Oliver Gugger
b1c8a836e3
multi: thread thru the AuxLeafStore everywhere 2024-10-11 14:11:58 +02:00
Olaoluwa Osuntokun
180648072c
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-10-11 14:11:58 +02:00
Olaoluwa Osuntokun
eb600a9447
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-10-11 14:11:58 +02:00
Olaoluwa Osuntokun
1f785e897e
channeldb: convert RevocationLog to use RecordT 2024-10-11 14:11:57 +02:00
Olaoluwa Osuntokun
314a24689c
channeldb: convert HTLCEntry to use tlv.RecordT 2024-10-11 14:11:57 +02:00
Olaoluwa Osuntokun
12ab2c3b51
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-10-11 14:11:57 +02:00
Olaoluwa Osuntokun
ef56d8654e
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-10-11 14:11:57 +02:00
Olaoluwa Osuntokun
9db810d67a
input: add some utility type definitions for aux leaves
In this commit, we add some useful type definitions for the aux leaf.
2024-10-11 14:11:57 +02:00
Olaoluwa Osuntokun
ae1b121cdd
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-10-11 14:11:57 +02:00
Olaoluwa Osuntokun
da9ceb131b
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-10-11 14:11:57 +02:00
Olaoluwa Osuntokun
cd155d7d17
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-10-11 14:11:56 +02:00
Olaoluwa Osuntokun
41bd293f33
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-10-11 14:11:56 +02:00
Olaoluwa Osuntokun
ca5dcbbf5c
lnwallet: add initial unit tests for musig2+tapscript root chans 2024-10-11 14:11:56 +02:00
Olaoluwa Osuntokun
cae4f21897
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-10-11 14:11:56 +02:00
Olaoluwa Osuntokun
62713c1270
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-10-11 14:11:56 +02:00
Olaoluwa Osuntokun
b7e153fd82
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-10-11 14:11:56 +02:00
Olaoluwa Osuntokun
9fd8287c7b
lnwallet/chanfunding: add optional tapscript root 2024-10-11 14:11:55 +02:00
Olaoluwa Osuntokun
1e71b1e544
multi: add new tapscript root option 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-10-11 14:11:55 +02:00
Olaoluwa Osuntokun
74cb1f48ad
channeldb: add optional TapscriptRoot field + feature bit 2024-10-11 14:11:55 +02:00
Olaoluwa Osuntokun
e71627f893
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-10-11 14:11:55 +02:00
Oliver Gugger
264dcd0641
Merge branch '0-18-4-branch-rc1-9025' into 0-18-4-branch-rc1 2024-10-11 14:04:01 +02:00