Commit Graph

17162 Commits

Author SHA1 Message Date
ffranr
af50694643
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-09-05 11:18:15 +02:00
ffranr
17c0a70b07
lnwire: add unit tests for ExtraOpaqueData.PackRecords 2024-09-05 10:29:42 +02:00
George Tsagkarelis
705e567357
itest: add dynamic scid alias routing test 2024-09-05 10:29:42 +02:00
George Tsagkarelis
70f82bc4ff
routerrpc: add XAddLocalChanAliases & XDeleteLocalChanAliases 2024-09-05 10:29:42 +02:00
Oliver Gugger
604bd81100
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-09-05 08:44:33 +02:00
Oliver Gugger
466f550ddb
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-09-05 08:44:33 +02:00
Oliver Gugger
80dfaeb16d
aliasmgr: add map type alias 2024-09-05 08:44:33 +02:00
George Tsagkarelis
ea92d0aecc
multi: refresh htlcswitch aliases on aliasmgr update 2024-09-05 08:44:32 +02:00
George Tsagkarelis
e31cdc4db3
aliasmgr: add delete local alias method 2024-09-05 08:44:32 +02:00
Olaoluwa Osuntokun
6747fc13b4
Merge pull request #9063 from guggero/update-sqldb
mod: bump sqldb to latest version
2024-09-04 13:18:21 -07:00
Oliver Gugger
6900fb54e2
Merge pull request #9064 from longhutianjie/master
bug: fix json tag
2024-09-04 05:43:01 -06:00
longhutianjie
26dd72d93a
bug: fix json tag 2024-09-04 18:03:15 +08:00
Oliver Gugger
cb85e6f8ba
mod: bump sqldb to latest version 2024-09-04 09:33:27 +02:00
Oliver Gugger
258cf81240
Merge pull request #9050 from bhandras/native-sql-invoice-fixes
invoices+sqldb: small fixes to address some inconsistencies between KV and native SQL invoice DB implementations
2024-09-04 01:30:52 -06:00
Olaoluwa Osuntokun
ce27e4e62c
Merge pull request #9046 from Roasbeef/taproot-chan-sync-bug-fix
lnwallet: ensure we re-sign retransmitted commits for taproot channels
2024-09-03 17:25:19 -07:00
Olaoluwa Osuntokun
80b257991e
docs/release-notes: add release notes entry for taproot chans bug fix 2024-09-03 17:23:53 -07:00
Olaoluwa Osuntokun
b8e39c2311
lnwallet: expand chan sync tests to cover taproot channels
In this commit, we expand some of the existing chan sync tests to cover
taproot channels (the others already did). Along the way, we always
assert that the `PartialSig` is populated on retransmission. In
addition, we now send the new commit sig rather than the existing
in-memory one to test the new logic that re-signs the commitment.
2024-09-03 17:23:48 -07:00
Olaoluwa Osuntokun
528199839a
lnwallet: extract initMusigNonce from initRevocationWindows
This'll be useful later to make some enhancements to the existing unit
tests.
2024-09-03 17:23:46 -07:00
Olaoluwa Osuntokun
69a1cf4f23
lnwallet: ensure we re-sign retransmitted commits for taproot channels
In this commit, we fix an existing bug with the taproot channel type
that can cause force closes if a peer disconnects while attempting to
send the commitment signature.

Before this commit, since the `PartialSig` we send is never committed to
disk, the version read wouldn't contain the musig2 partial sig. We never
write these signatures to disk, as each time we make a new session, we
need to generate fresh nonces to avoid nonce-reuse.

Due to the above interaction, if we went to re-send a signature after a
disconnection, the `CommitSig` message we sent wouldn't actually contain
a `PartialSigWithNonce`, causing a protocol error.
2024-09-03 17:23:38 -07:00
Andras Banki-Horvath
1f7ac8e853
docs: update docs/release-notes/release-notes-0.18.3.md 2024-09-03 19:42:52 +02:00
Andras Banki-Horvath
06d4267a76
sqldb: fix end date filter when querying invoices
Previously, the SQL implementation of the invoice query simply
converted the start and end timestamps to time and used them
in SQL queries to check for inclusivity. However, this logic
failed when the start and end timestamps were equal.

This commit addresses and corrects this issue.
2024-09-03 19:40:47 +02:00
Andras Banki-Horvath
b57910ee3a
sqldb+invoices: synchronize SQL invoice updater behavior with KV version
Previously SQL invoice updater ignored the set ID hint when updating an
AMP invoice resulting in update subscriptions returning all of the AMP
state as well as all AMP HTLCs. This commit synchornizes behavior with
the KV implementation such that we now only return relevant AMP state
and HTLCs when updating an AMP invoice.
2024-09-03 19:40:46 +02:00
Andras Banki-Horvath
c8de7a1699
channeldb: filter AMP state to relevant set IDs
When fetching an AMP invoice we sometimes filter HTLCs to selected set
IDs, however we always kept the full AMP state which is irrelevant as it
contains state for all AMP payments. This was a side effect of
UpdateInvoice needing to serialize the whole invoice when storing after
an update but it is an unwanted "feature" as users will need to filter
to relevant set when listing an AMP payment or subsribing to an update.
2024-09-03 19:40:46 +02:00
Alex Akselrod
ffbdcc1d5d
invoices: ensure AMP subinvoices are correctly updated w/nativesql 2024-09-03 19:40:46 +02:00
Alex Akselrod
e3a939aa0d
itest: check that AMP subinvoices are correctly updated w/nativesql 2024-09-03 19:40:46 +02:00
Alex Akselrod
f1b7953465
invoices/sqldb: query by ChanID when updating AMP invoice preimage 2024-09-03 19:40:45 +02:00
Oliver Gugger
e8c5e7d5ce
Merge pull request #9044 from ProofOfKeags/refactor/stfu-prefactor
Refactor/stfu prefactor
2024-08-29 09:49:53 -06:00
Oliver Gugger
54eeb0e792
Merge pull request #9045 from ziggie1984/fix-blinded-payment-tc
fix blinded path itest.
2024-08-29 04:51:20 -06:00
ziggie
64fb4cb4ac
itest: fix blinded path itest. 2024-08-29 09:50:46 +02:00
Keagan McClelland
1422729f80
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-08-28 14:03:00 -07:00
Keagan McClelland
ce7fcd30f8
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-08-28 14:02:59 -07:00
Keagan McClelland
2e7fbc446f
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-08-28 13:58:33 -07:00
Keagan McClelland
8077862225
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-08-28 13:51:23 -07:00
Keagan McClelland
a0515a16db
htlcswitch: extract error handling for syncChanStates 2024-08-28 13:46:52 -07:00
Oliver Gugger
5c3a8e949c
Merge pull request #9030 from lightningnetwork/extract-part1-from-staging-branch
[custom channels 1/5]: extract PART1 from mega staging branch
2024-08-28 07:06:53 -06:00
Oliver Gugger
9dfbde7013
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-08-28 13:28:48 +02:00
Oliver Gugger
2ab22b0f0b
lnwallet: refactor commit keys to use lntypes.Dual 2024-08-28 13:26:18 +02:00
Oliver Gugger
b45d72fe59
multi: thread thru the AuxLeafStore everywhere 2024-08-28 13:26:14 +02:00
Olaoluwa Osuntokun
2510c19024
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-08-28 13:24:04 +02:00
Olaoluwa Osuntokun
669740c84e
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-08-28 13:23:30 +02:00
Olaoluwa Osuntokun
61f276856a
channeldb: convert RevocationLog to use RecordT 2024-08-28 13:22:48 +02:00
Olaoluwa Osuntokun
1b1e7a6168
channeldb: convert HTLCEntry to use tlv.RecordT 2024-08-28 13:21:46 +02:00
Olaoluwa Osuntokun
c1e641e9d9
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-08-28 13:21:12 +02:00
Olaoluwa Osuntokun
d95c1f93f3
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-08-28 13:21:08 +02:00
Olaoluwa Osuntokun
c36cd9298f
input: add some utility type definitions for aux leaves
In this commit, we add some useful type definitions for the aux leaf.
2024-08-28 11:52:32 +02:00
Olaoluwa Osuntokun
d25f881433
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-08-28 11:52:32 +02:00
Olaoluwa Osuntokun
12352d9e6e
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-08-28 11:52:32 +02:00
Olaoluwa Osuntokun
5c4428c3cf
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-08-28 11:52:32 +02:00
Olaoluwa Osuntokun
1aae47fd71
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-08-28 11:52:31 +02:00
Olaoluwa Osuntokun
8588c9bfd7
lnwallet: add initial unit tests for musig2+tapscript root chans 2024-08-28 11:52:31 +02:00