Commit Graph

19586 Commits

Author SHA1 Message Date
Elle Mouton
6b38f8d9df graph/db: update TestAddrSerialization 2025-08-15 05:53:04 +00:00
Elle Mouton
3fa137e187 graph/db+chanbackup: dns add encoding/decoding for persistence 2025-08-15 05:53:04 +00:00
Elle Mouton
dc4111aad0 graph/db: update test opaque addr to be valid
The first byte of an opaque addr must be one that we dont understand
yet. We do this update in preparation for doing an on-the-fly parse of
persisted opaque addrs to see if they contain addrs that we now support.
For this to work, the first byte cant be 0x01 since this maps to a known
address.
2025-08-15 05:53:04 +00:00
Elle Mouton
0a064d531c lnwire: extract addr descriptor reading logic
cause we will need to be able to deserialise any persisted OpaqueAddrs
which will have a Payload that we should be able to decode with this
lnwire method to extract any new addresses that we now support.

Co-authored-by: Elle Mouton <elle.mouton@gmail.com>
2025-08-15 05:53:04 +00:00
Elle Mouton
5844bb0477 discovery+gossip: make sure we dont advertise node anns with bad DNS
We may have already persisted node announcements that have multiple DNS
addresses since we may have received them before updating our code to
check for this. So here we just make sure not to send these on to our
peers.
2025-08-15 05:53:04 +00:00
Elle Mouton
a7ae21d685 netadd: split ValidatenodeAnn into sig and field checks
Check that the node ann doesnt contain more than 1 DNS addr.
This will ensure that we now start rejecting new node announcements
with multiple DNS addrs since this check is called in the gossiper
before persisting a node ann to our local graph.

It also validates the DNS fields according to BOLT #7 specs.
2025-08-15 05:53:03 +00:00
Elle Mouton
41bd519859 lnwire: add encoding/decoding for DNS addr
Co-authored-by: Elle Mouton <elle.mouton@gmail.com>
2025-08-15 05:49:13 +00:00
Mohamed Awnallah
4d9f884c3f lnwire: add DNSAddress type 2025-08-15 05:49:11 +00:00
Mohamed Awnallah
05e4370ebd lnwire: remove AddrLen helper
In this commit, we remove `AddrLen` as prepration step
before adding DNS address type which will have a var length.

Co-authored-by: Elle Mouton <elle.mouton@gmail.com>
2025-08-15 03:35:00 +00:00
Oliver Gugger
31fc556507 Merge pull request #10155 from ziggie1984/add-missing-invoice-settle-index
Add missing invoice index for native sql
2025-08-14 09:23:37 -06:00
Oliver Gugger
4b3ede5cb0 Merge pull request #10154 from ellemouton/graphPerf11
graph/db: use batch validation to improve SQL migration performance
2025-08-14 05:54:21 -06:00
ziggie
35e9979d67 docs: add schema update doc 2025-08-14 12:00:40 +02:00
ziggie
b98cc24cfe docs: add release-notes 2025-08-14 12:00:40 +02:00
ziggie
ea9fb80eff sqldb: use the new schema
We put this new schema update into the main line and change the
versions of the schema updates which are currently only available
in dev builds. The schemas need to be chronological therefore we
also need to rename the file numbers.
2025-08-14 11:59:09 +02:00
ziggie
506d226eb3 sqldb: add missing index for settled invoices 2025-08-14 08:17:15 +02:00
ziggie
22fbbee837 sqldb: delete wrong index names and add missing one 2025-08-14 08:17:15 +02:00
Elle Mouton
f560c4d95b sqldb: use uint32 for config values 2025-08-14 08:03:28 +02:00
Elle Mouton
d5729845d0 graph/db: remove outdated TODO 2025-08-14 08:00:07 +02:00
Elle Mouton
b1c643f4f1 graph/db: add migration timing logs
Time the full duration of each graph migration step for the purposes of
logging.
2025-08-14 08:00:07 +02:00
Elle Mouton
5b06474744 graph/db+sqldb: batch validation for zombie index migration
Finally, we update the migrateZombieIndex function to use batch
validation just like was done in the previous commits. Here, we
additionally make sure to validate the entire zombie index entry and not
just the SCID.
2025-08-14 08:00:07 +02:00
Elle Mouton
a490e03479 graph/db+sqldb: use batch validation for closed SCID migration
As was done in the previous commits for nodes & channels, we update the
migrateClosedSCIDIndex function here so that it validates migrated
entries in batches rather than one-by-one.
2025-08-14 08:00:06 +02:00
Elle Mouton
8554f17b3f graph/db+sqldb: validate prune log migration using batching
As was done in the previous commits for nodes & channels, we update the
migratePruneLog function here so that it validates migrated entries in
batches rather than one-by-one.
2025-08-14 08:00:06 +02:00
Elle Mouton
81c54611c1 graph/db+sqldb: use batch fetching during channel&policy migration
Restructue the `migrateChannelsAndPolicies` function so that it does the
validation of migrated channels and policies in batches. So instead of
fetching channel and its policies individually after migrating it, we
wait for a minimum batch size to be reached and then validate a batch of
them together. This lets us make way fewer DB round trips.
2025-08-14 08:00:06 +02:00
Elle Mouton
03ef2740a6 graph/db+sqldb: use batch validation for node migration
Restructue the `migrateNodes` function so that it does the validation of
migrated nodes in batches. So instead of fetching each node individually
after migrating it, we wait for a minimum batch size to be reached and
then validate a batch of nodes together. This lets us make way fewer DB
round trips.
2025-08-14 08:00:06 +02:00
Elle Mouton
218aa9eaa8 graph/db: move sanity check out of insertChannel
We do this so that this lookup is only done in the situation it is
actually needed. During a migration, we dont need to special case this
AlreadyExists error since we will terminate the transaction either way.
So there is no need for the extra lookup during the migration.

A timing analysis showed that this query was significantly impacting the
performance of the migration when run with a postgres backend.
2025-08-14 07:57:33 +02:00
Elle
5f3055944a Merge pull request #10148 from ellemouton/graphPerf10
graph/db+sqldb: different defaults for SQLite and Postgres query options
2025-08-14 07:56:28 +02:00
Elle Mouton
b1deddec44 multi: remove DefaultQueryConfig
And always make use of either the new DefaultSQLiteConfig or
DefaultPostgresConfig.
2025-08-13 14:43:31 +02:00
Elle Mouton
1082eaaeb3 graph/db: fix progress logs 2025-08-13 14:43:31 +02:00
Elle Mouton
6a31e06817 graph/db+sqldb: find best default query cfg values for sqlite & postgres
This commit adds a BenchmarkFindOptimalSQLQueryConfig test in the
graph/db package which runs ForEachNode and ForEachChannel queries
against a local backend using various different values for the sql
QueryConfig struct. This is done to determine good default values to
use for the config options for sqlite vs postgres.
2025-08-13 14:43:31 +02:00
Elle Mouton
185166b8d3 sqldb+config: validate maximum batch size config value
Now that the SQL query config values are configurable, we add some
validation to make sure that the user doesnt set a max batch size that
is larger than the limits for sqlite/postgres that have been determined
by the TestSQLSliceQueries test.
2025-08-13 14:43:31 +02:00
Elle Mouton
ee292786b1 config+sqldb: make native SQL query config options configurable
Here, we make the sql query option params (batch size and pagination
size) configurable. The defaults for SQLite vs Postgres are still the
same but will be changed in an upcoming commit.
2025-08-13 14:43:31 +02:00
Yong
c6a9116e3a Merge pull request #9844 from ziggie1984/refactor-payments-code-03
Refactor Payment PR 3
2025-08-13 06:05:01 -04:00
Elle Mouton
75691163a9 graph: remove outdated TODO
This todo has been addressed.
2025-08-13 08:45:52 +02:00
Olaoluwa Osuntokun
8810793e61 Merge pull request #9871 from GeorgeTsagk/htlc-noop-add
Add `NoopAdd` HTLCs
2025-08-12 11:56:04 -07:00
ziggie
4e0af2f495 channeldb: rename storedPaymentSeq 2025-08-11 16:44:15 +02:00
ziggie
a4b1569647 channeldb: rename currPaymentSeq 2025-08-11 16:44:15 +02:00
ziggie
6bae3c98b3 channeldb: rename paymentSeqMx 2025-08-11 16:44:14 +02:00
ziggie
88da582526 mulit: use kvdb.Backend for the kv payment db
Instead of the ChannelState struct we now use the kv backend
interface for the payment kv database.
2025-08-11 16:44:14 +02:00
ziggie
3aec40293d paymentsdb: add subsystem logging for payments package 2025-08-11 16:44:14 +02:00
ziggie
18afd4442d multi: introduce new paymentsDB package
We introduce a new package paymentsDB and start by moving the
payment specifc errors from the channeldb package to the
paymentsDB package. We also fix linter issues which showed up
due to changing this code part.
2025-08-11 16:44:14 +02:00
ziggie
db2c50a599 channeldb: add context to query method
We add a context for the query method because the query method
is part of the paymentDB interface and for the SQL case
we will need the context for this method because the native
SQL drivers demand one. So we add it for the kv implementation
here as well so we can then make use of the new interface type.
2025-08-11 16:44:13 +02:00
Yong
f3e1f2f351 Merge pull request #10141 from ziggie1984/fix-stuck-payment
fix stuck payment
2025-08-11 19:44:12 +08:00
Oliver Gugger
d11d699443 Merge pull request #10147 from hieblmi/update-hieblmi-key
scripts: update hieblmi pgp key
2025-08-11 04:52:22 -06:00
Slyghtning
1ce64eb45f scripts: update hieblmi pgp key 2025-08-11 11:47:40 +02:00
Oliver Gugger
72e9ad8e65 Merge pull request #10144 from jtobin/jt/aux-error
server: don't mention aux controllers in error message
2025-08-11 00:42:12 -06:00
Jared Tobin
5688935354 server: don't mention aux stuff in error [skip ci]
This error is returned when one attempts to use taproot overlay channels
without the necessary auxiliary funding controller being supplied. In
practice, when running lnd via litd, the latter will always supply
'tapd' as the aux funding controller, but a standalone lnd has no
knowledge of that.

The previous message sort of reads like the lnd user has forgotten to
set some available option or flag, but nothing or the sort actually
exists. The update makes it clearer that the feature isn't available in
the standalone build.
2025-08-08 16:10:53 -02:30
George Tsagkarelis
97bbbf14f9 docs: update release notes for NoOp HTLCs 2025-08-08 20:03:30 +02:00
George Tsagkarelis
47d1365fde lnwallet: add table-driven test for evaluateNoOpHtlc helper 2025-08-08 20:03:30 +02:00
George Tsagkarelis
4a34f78fba lnwallet: add noop case to retransmit test
To make sure we don't cause force-closures because of commit sig
mismatches, we add a test case to verify that the retransmitted HTLC
matches the original HTLC.
2025-08-08 20:03:30 +02:00
George Tsagkarelis
e0486697df lnwallet: add noop HTLC tests
Adds some simple tests to check the noop HTLC logic of the lightning
channel.
2025-08-08 20:03:30 +02:00