Commit Graph

19606 Commits

Author SHA1 Message Date
MPins
2815d4922c doc: release-notes-0.20.0 2025-08-01 13:09:33 -07:00
MPins
e61d971ce4 zpay32: test case for empty routing hints on r fields 2025-08-01 13:09:25 -07:00
MPins
16187f047a zpay32: validate empty routing hints when parsing r fields 2025-08-01 13:09:17 -07:00
MPins
b8acca2c89 zpay32: test case for parsing non UTF-8 description 2025-08-01 13:09:04 -07:00
MPins
2b1a89fbaf zpay32: validate UTF-8 parsing field description 2025-08-01 13:08:31 -07:00
Olaoluwa Osuntokun
8dcb7a8f8b docs/release-notes: add release notes entry 2025-08-01 11:20:22 -05:00
Olaoluwa Osuntokun
7e767eac82 discovery: only permit a single gossip backlog goroutine per peer
In this commit, we add a new atomic bool to only permit a single gossip
backlog goroutine per peer. If we get a new reuqest that needs a backlog
while we're still processing the other, then we'll drop that request.
2025-08-01 11:20:22 -05:00
Olaoluwa Osuntokun
5fcd33c50c discovery: add tests for for async timestamp range queue 2025-08-01 11:20:22 -05:00
Olaoluwa Osuntokun
ed717a120a docs: add comprehensive gossip rate limiting guide
In this commit, we add detailed documentation to help node operators
understand and configure the gossip rate limiting system effectively.
The new guide addresses a critical knowledge gap that has led to
misconfigured nodes experiencing synchronization failures.

The documentation covers the token bucket algorithm used for rate
limiting, providing clear formulas and examples for calculating
appropriate values based on node size and network position. We include
specific recommendations ranging from 50 KB/s for small nodes to
1 MB/s for large routing nodes, with detailed calculations showing
how these values are derived.

The guide explains the relationship between rate limiting and other
configuration options like num-restricted-slots and the new
filter-concurrency setting. We provide troubleshooting steps for
common issues like slow initial sync and peer disconnections, along
with debug commands and log patterns to identify problems.

Configuration examples are provided for conservative, balanced, and
performance-oriented setups, giving operators concrete starting points
they can adapt to their specific needs. The documentation emphasizes
the importance of not setting rate limits too low, warning that values
below 50 KB/s can cause synchronization to fail entirely.
2025-08-01 11:20:21 -05:00
Olaoluwa Osuntokun
7f16b24192 multi: wire up gossip filter concurrency config
In this commit, we complete the integration of the configurable gossip
filter concurrency by wiring the new FilterConcurrency configuration
through all layers of the application.

The changes connect the gossip.filter-concurrency configuration option
from the command-line interface through the server initialization code
to the gossiper and sync manager. This ensures that operators can
actually use the new configuration option to tune their node's
concurrent gossip filter processing capacity based on their specific
requirements and available resources.
2025-08-01 11:20:21 -05:00
Olaoluwa Osuntokun
f3ba372441 discovery: integrate async queue in ProcessRemoteAnnouncement
In this commit, we complete the integration of the asynchronous
timestamp range queue by modifying ProcessRemoteAnnouncement to use
the new queuing mechanism instead of calling ApplyGossipFilter
synchronously.

This change ensures that when a peer sends a GossipTimestampRange
message, it is queued for asynchronous processing rather than
blocking the gossiper's main message processing loop. The modification
prevents the peer's readHandler from blocking on potentially slow
gossip filter operations, maintaining connection stability during
periods of high synchronization activity.

If the queue is full when attempting to enqueue a message, we log
a warning but return success to prevent peer disconnection. This
design choice prioritizes connection stability over guaranteed
delivery of every gossip filter request, which is acceptable since
peers can always resend timestamp range messages if needed.
2025-08-01 11:20:21 -05:00
Olaoluwa Osuntokun
7fb289f24f discovery: add async timestamp range queue to prevent blocking
In this commit, we introduce an asynchronous processing queue for
GossipTimestampRange messages in the GossipSyncer. This change addresses
a critical issue where the gossiper could block indefinitely when
processing timestamp range messages during periods of high load.

Previously, when a peer sent a GossipTimestampRange message, the
gossiper would synchronously call ApplyGossipFilter, which could block
on semaphore acquisition, database queries, and rate limiting. This
synchronous processing created a bottleneck where the entire peer
message processing pipeline would stall, potentially causing timeouts
and disconnections.

The new design adds a timestampRangeQueue channel with a capacity of 1
message and a dedicated goroutine for processing these messages
asynchronously. This follows the established pattern used for other
message types in the syncer. When the queue is full, we drop messages
and log a warning rather than blocking indefinitely, providing graceful
degradation under extreme load conditions.
2025-08-01 11:20:21 -05:00
Olaoluwa Osuntokun
694cc15a73 discovery: make gossip filter semaphore capacity configurable
In this commit, we make the gossip filter semaphore capacity configurable
through a new FilterConcurrency field. This change allows node operators
to tune the number of concurrent gossip filter applications based on
their node's resources and network position.

The previous hard-coded limit of 5 concurrent filter applications could
become a bottleneck when multiple peers attempt to synchronize
simultaneously. By making this value configurable via the new
gossip.filter-concurrency option, operators can increase this limit
for better performance on well-resourced nodes or maintain conservative
values on resource-constrained systems.

We keep the default value at 5 to maintain backward compatibility and
avoid unexpected resource usage increases for existing deployments. The
sample configuration file is updated to document this new option.
2025-08-01 11:20:19 -05:00
ziggie
252ebdea5b channeldb: rename payment_control files
We rename the file to payment_kv_store to highlight that this
is the kv implementation of the payment db backend.
2025-08-01 17:51:11 +02:00
Elle Mouton
31978b99f4 graph/db: update forEachNodeCacheable to use sqldb helper
A pure refactor which updates forEachNodeCacheable to make use of the
new sqldb.ExecutePaginatedQuery helper.
2025-07-31 15:33:08 +02:00
Elle Mouton
2d09acfca2 graph/db: update ForEachChannelCacheable to use new helper
A pure refactor commit which updates ForEachChannelCacheable to make use
of the new sqldb.ExecutePaginatedQuery helper.
2025-07-31 15:33:08 +02:00
Elle Mouton
61299894e1 graph/db: add buildCachedChanPolicies helper
Here we just remove some code duplication by adding a
buildCachedChanPolicies helper.
2025-07-31 15:33:08 +02:00
Elle Mouton
0f7c0ae9e7 graph/db: refactor to use sqldb.QueryConfig value
This commit is a pure refactor. Here all we are doing is removing the
old `pageSize` constant used in the SQLStore code and instead using the
value provided in the QueryConfig struct.
2025-07-31 15:33:08 +02:00
Elle Mouton
e276f1ec3e sqldb: add ExecutePaginatedQuery helper
In this commit we add the ExecutePaginatedQuery helper function which
can be used to execute cursor-based paginated queries.
2025-07-31 15:33:07 +02:00
Elle Mouton
a6248872cb sqldb: rename ExecutePagedQuery to ExecuteBatchQuery
We rename this helper along the config types & helper types for it
because the word "page" is used more often in the context of paging
through results using an offset and limit whereas this helper is
specifically used to split up the slice in queries of the form
"WHERE x in []slice". We do this rename so that there is mimimal
confusion in contexts where we use batching along with actual paging.

The config struct is also renamed to QueryConfig in preparation for it
holding more config options.
2025-07-31 15:32:53 +02:00
Oliver Gugger
37523b6cb7 Merge pull request #10100 from Abdulkbk/fix-chanid-flag
commands: fix how we parse chan ids args at CLI level
2025-07-31 06:49:46 -06:00
András Bánki-Horváth
9ffbb977e8 Merge pull request #10034 from bhandras/fuzzy-matching-script
scripts: add cherry-pick verification tool with fuzzy matching
2025-07-31 14:40:14 +02:00
Elle
b5c290d90f Merge pull request #10116 from ellemouton/graphPerf4
[3] graph/db: batch-fetch channel & policy data
2025-07-31 10:03:25 +02:00
Elle Mouton
c1ba7a97a8 graph/db: increase default page size 2025-07-31 07:19:15 +02:00
Elle Mouton
a6b077064f graph/db: use batch loading for ForEachChannel 2025-07-31 07:19:15 +02:00
Elle Mouton
d5da637a38 graph/db: remove unused param 2025-07-31 07:19:14 +02:00
Elle Mouton
f39edae6e3 graph/db: use new batch helpers for edge loading
Use the new batch helpers to replace the existing logic for loading an
edge.
2025-07-31 07:19:14 +02:00
Elle Mouton
8ad5f633bc sqldb: add channel data batch queries
Also add the calling logic for these queries. This logic is not yet
used.
2025-07-31 07:19:14 +02:00
Elle
23dd01cb35 Merge pull request #10115 from ellemouton/graphPerf3
[2] graph/db: batch-fetch node data
2025-07-31 07:17:15 +02:00
Elle Mouton
6ca43173a1 sqldb: change default slices page size 2025-07-30 19:29:23 +02:00
Elle Mouton
36eb0e3ff6 graph/db: use batch loading for NodeUpdatesInHorizon 2025-07-30 19:29:22 +02:00
Elle Mouton
c8c86717f2 graph/db: add NodeUpdatesInHorizon benchmark 2025-07-30 19:29:22 +02:00
Elle Mouton
84b1670742 graph/db: use batch loading for ForEachNode 2025-07-30 19:29:22 +02:00
Elle Mouton
d05b918c7a graph/db: refactor buildNode to use batch fetching
Here, we add a new `buildNodeWithBatchData` helper method that can be
used to construct a `models.LightningNode` object using pre-fetched
batch data. The existing `buildNode` method is then adjusted to use this
new helper.
2025-07-30 19:29:22 +02:00
Elle Mouton
0dc0d320f8 graph/db+sqldb: queries and logic for batch fetching node data
In this commit, we add the queries that will be needed to batch-fetch
the data of a set of nodes. The logic for using these new queries is
also added but not used yet.
2025-07-30 19:29:21 +02:00
Elle
4389067989 Merge pull request #10113 from ellemouton/graphPerf2
[1] graph/db: add some SQL performance improvements
2025-07-30 19:27:21 +02:00
Elle Mouton
5a1184c664 graph/db+sqldb: remove LEFT JOIN for fetching node addresses
In this commit, we remove the LEFT JOIN query that was used for fetching
a nodes addresses. The reason it was used before was to ensure that we'd
get an empty address list if the node did exist but had no addresses.
This was for the purposes of the `AddrsForNode` method since it needs to
return false/true to indicate if the given node exists.
2025-07-30 18:11:01 +02:00
Elle Mouton
43db6683d2 graph/db+sqldb: only fetch what is needed for graph cache
Add a ListChannelsWithPoliciesForCachePaginated query that only fetches
the channel/policy fields that the cache requires.
2025-07-30 18:11:01 +02:00
Elle Mouton
3eed2f94c1 sqldb/sqlc: add index on graph_channels(version, id)
This new index greatly improves the speed of the
ListChannelsWithPoliciesPaginated query.
2025-07-30 18:11:01 +02:00
Oliver Gugger
f7efc15a9e Merge pull request #9625 from MPins/issue-8161
Add deletecanceledinvoice RPC call
2025-07-30 09:14:06 -06:00
Oliver Gugger
117035d95c Merge pull request #10109 from ellemouton/graphPerf1
graph/db: helper tests and some benchmarks for SQL
2025-07-30 09:10:45 -06:00
Elle Mouton
5800a3e054 graph/db: benchmark various graph read calls
This commit adds benchmark tests for the ForEachNode and ForEachChannel
DB calls which are called by DescribeGraph.
2025-07-30 14:06:33 +02:00
Elle Mouton
f5ce4a5656 graph/db: add BenchmarkCacheLoading
Add a benchmark test to test graph cache loading against various local
graph DBs.
2025-07-30 14:06:33 +02:00
Elle Mouton
45033b8c54 graph/db: add SQL migration progress logs 2025-07-30 14:06:33 +02:00
Elle Mouton
77fe1816f6 graph/db: add test helper for populating via migration
This commit adds a helper test that is similar to TestPopulateDBs except
for the fact that it uses the MigrateGraphToSQL function directly to
migrate a local kvdb-sql graph to a native SQL one.
2025-07-30 14:06:33 +02:00
Elle Mouton
afbe6b12ed graph/db: define various db connection helpers for incoming tests
This is a prep commit that just adds all the boilerplate connection
logic for connecting to various graph DBs. These will be used in
upcoming commits which will add tests and benchmarks.
2025-07-30 14:06:33 +02:00
MPins
4b521e1647 doc: release-notes-0.20.0 2025-07-29 13:55:23 -03:00
MPins
1a9f591b2b itest: add the test for DeleteCanceledInvoice 2025-07-29 13:55:17 -03:00
Olaoluwa Osuntokun
0eacd07c60 Merge pull request #10107 from ellemouton/fixLogLevelInheritance
go.mod: bump btclog v2 version
2025-07-29 12:29:52 -04:00
Elle Mouton
240966de90 graph/db+log: use v2 logger for graph subsystem 2025-07-29 11:34:47 +02:00