Commit Graph
100 Commits
Author SHA1 Message Date
Olaoluwa Osuntokun 113aaf1607 docs: create new document describing proposed release/branch management
In this PR, we aim to create a central document that describes how we
want to drive the release process, as well as branch management going
forward.
2025-11-11 12:42:27 -08:00
Olaoluwa Osuntokun aeac3380ac Merge pull request #10345 from Roasbeef/v7-rc4
build: bump version to v0.20.0-beta rc4
2025-11-05 12:25:53 -08:00
Olaoluwa Osuntokun 2ddb630a95 build: bump version to v0.7.0 rc4 2025-11-04 14:43:12 -08:00
Olaoluwa Osuntokun 4131a8e586 Merge pull request #10330 from Roasbeef/fix-error-handling-gossiper
discovery: fix potential infinite loop bug re context cancel error handling in gossip syncer
2025-11-03 11:57:51 -08:00
Olaoluwa Osuntokun adaa893f22 docs: add release notes entry 2025-11-03 10:44:14 -08:00
Olaoluwa Osuntokun b8ca876409 discovery/test: add comprehensive tests for state handler error exits
Add comprehensive test coverage to verify that state handler errors cause
the channelGraphSyncer goroutine to exit cleanly without entering endless
retry loops. These tests use mutation testing principles to ensure they
would fail if the fixes were removed.

TestGossipSyncerStateHandlerErrors is a table-driven test covering four
scenarios: context cancellation and peer disconnect during syncingChans
state, and context cancellation and network errors during queryNewChannels
state. Each test case verifies both attempt count (no endless loop) and
clean shutdown (no deadlock).

TestGossipSyncerProcessChanRangeReplyError verifies that errors from
processChanRangeReply in the waitingQueryRangeReply state cause clean
exit. This test sends multiple malformed messages and checks that only
the first is processed before the goroutine exits, using channel queue
depth to detect if the goroutine is still running.

All tests are race-detector clean and use mutation testing validation:
removing any of the error return statements causes the corresponding
tests to fail, confirming the tests properly verify the fixes.
2025-11-03 10:44:13 -08:00
Olaoluwa Osuntokun 06c7d60452 discovery: fix endless loop in gossip syncer on context cancellation
This commit fixes a critical bug where the channelGraphSyncer goroutine
would enter an endless loop when context cancellation or peer disconnect
errors occurred during the syncingChans or queryNewChannels states.

The root cause was that state handler functions (handleSyncingChans and
synchronizeChanIDs) did not return errors to the main goroutine loop.
When these functions encountered fatal errors like context cancellation,
they would log the error and return early without changing the syncer's
state. This caused the main loop to immediately re-enter the same state
handler, encounter the same error, and loop indefinitely while spamming
error logs.

The fix makes error handling explicit by having state handlers return
errors. The main channelGraphSyncer loop now checks these errors and
exits cleanly when fatal errors occur. We return any error (not just
context cancellation) because fatal errors can manifest in multiple
forms: context.Canceled, ErrGossipSyncerExiting from the rate limiter,
lnpeer.ErrPeerExiting from Brontide, or network errors like connection
closed. This approach matches the error handling pattern already used in
other goroutines like replyHandler.
2025-11-03 10:44:12 -08:00
Olaoluwa Osuntokun f938e40afe Merge pull request #10324 from Roasbeef/v-20-branch-rc3
build: bump version to v0.20 rc3
2025-10-28 16:51:30 -07:00
Olaoluwa Osuntokun 0ff9c2e67f build: bump version to v0.20 rc3 2025-10-27 16:35:12 -07:00
Olaoluwa Osuntokun 9a7b526c0c Merge pull request #10268 from starius/release-gnu-gzip
release.sh: make sure GNU gzip is used
2025-10-27 10:34:30 -07:00
Olaoluwa Osuntokun 6a82c61f47 Merge pull request #10280 from mohamedawnallah/optimize-neutrino-rescan
rpcserver: resolve root cause of premature wallet rescanning
2025-10-23 19:33:21 +02:00
Olaoluwa Osuntokun 1a30ac29e3 Merge pull request #10309 from starius/bump-go-and-mapstructure
build: update Go 1.25.3 / 1.24.9
2025-10-22 17:52:25 +01:00
Olaoluwa Osuntokun 9f611402e2 Merge pull request #10313 from Roasbeef/roasbeef-key-expiry-update
scripts/keys: update roasbeef keys with new expiry
2025-10-22 15:21:23 +01:00
Olaoluwa Osuntokun 81ff01c9cc scripts/keys: update roasbeef keys with new expiry
My key recently expired, in this commit, we update the keys to the new
refreshed version. These are the same keys, but with an expiry further
out.

Here's a clear sign of the latest Bitcoin block hash:

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA512

000000000000000000013215ef7c32bc0427f388fc83623affe712f388
-----BEGIN PGP SIGNATURE-----

iHUEARYKAB0WIQQpYhJoGq3wVlaize6QUl997uCthgUCaPi6xwAKCRCQUl997uCt
hpqNAQC5VnnbO6h/PjywGhU4LLRvH8SdgdDEMSc7xrtWd1vgPgD+IDrHqiAb+h38
ORBnUVJCVuZrPebtdnYXVQhII91eaw4=
=WRbl
-----END PGP SIGNATURE-----
2025-10-22 12:07:38 +01:00
Olaoluwa Osuntokun ab0177c1a1 Merge pull request #10305 from Roasbeef/v-20-rc2
build: bump version to v0.20.0 rc2
2025-10-21 17:21:46 +01:00
Olaoluwa Osuntokun 8e75ef0c2c Merge pull request #10306 from Roasbeef/free-release-space
build: fix disk space exhaustion in release builds
2025-10-21 17:21:12 +01:00
Olaoluwa Osuntokun dfee57023c build: clear Go cache between platform builds in release script
In this commit, we add a call to "go clean -cache" after each platform
build in the release script to prevent the Go build cache from accumulating
unbounded disk space during the sequential 15-platform build process.

When building for multiple platforms in sequence with "go build -v", Go
creates intermediate build artifacts and caches compiled packages for each
target platform. While this caching improves build performance within a
single platform build, it causes the cache to grow substantially when
building for many platforms sequentially. With 15 different platform/
architecture combinations, each with their own cached artifacts, this
accumulation was contributing to the disk space exhaustion.

By clearing the build cache after each platform completes, we prevent this
unbounded growth while still allowing each individual platform build to
benefit from caching during its own compilation. The module cache is
preserved (we only clear the build cache), so dependencies don't need to be
re-downloaded between platforms.
2025-10-20 22:39:47 +01:00
Olaoluwa Osuntokun b82ed88be5 ci: use enhanced cleanup action in release workflow
In this commit, we replace the basic inline cleanup command in the release
workflow with the comprehensive cleanup-space action that was previously
only used in the main CI workflow. The previous release workflow cleanup
simply removed the hostedtoolcache directory, which freed only a few
gigabytes and proved insufficient for multi-platform release builds.

By switching to the cleanup-space action (now enhanced to free 20-25GB),
the release workflow will have substantially more disk space available
before beginning the build process. This should resolve the disk space
exhaustion issues that were occurring during the Windows ARM build phase,
which is one of the final platforms in the 15-platform build sequence.
2025-10-20 22:39:47 +01:00
Olaoluwa Osuntokun 2ccf4b9806 ci: enhance cleanup-space action for release builds
In this commit, we significantly expand the cleanup-space GitHub Actions
workflow to free up substantially more disk space on GitHub runners. The
previous cleanup only removed three large toolsets (dotnet, android,
ghc), which should free ~14GB. This enhancement adds removal of several
additional large packages and caches, bringing the total freed space to
approximately 20-25GB.

The specific additions include removing Swift and Julia language runtimes,
the hosted toolcache directory, all Docker images, numerous large apt
packages (aspnetcore, llvm, php, mongodb, mysql, azure-cli, browsers, and
development tools), and various cache directories. We also add disk space
reporting before and after cleanup to provide visibility into how much
space is actually being freed during workflow runs.

This enhancement was motivated by release builds running out of disk space
when building for all 15 supported platforms (darwin, freebsd, linux,
netbsd, openbsd, windows across multiple architectures). The sequential
builds with verbose output were consuming more space than the basic cleanup
could provide.
2025-10-20 22:39:47 +01:00
Olaoluwa Osuntokun 6b7ad41211 build: bump version to v0.20.0 rc2 2025-10-20 15:43:49 +01:00
Olaoluwa Osuntokun a315ad3b50 Merge pull request #10273 from ziggie1984/fix-nursery-height-hint
fix height hint Zero issue in utxonursery
2025-10-20 14:51:05 +01:00
Olaoluwa Osuntokun 6ade31d05c Merge pull request #10285 from Roasbeef/go-125-2
build: update CI+release version to Go 1.25.2
2025-10-11 15:05:49 +01:00
Olaoluwa Osuntokun 7fcbbd44ca build: update CI+release version to Go 1.25.2
We also update the go.mod files to pin to Go 1.24.8.
2025-10-11 13:39:51 +01:00
Olaoluwa Osuntokun bc07d97213 Merge pull request #10281 from ellemouton/gomodReplace
go.mod: remove sqldb and fn replacements
2025-10-09 15:06:26 +01:00
Olaoluwa Osuntokun 90c96c7df1 Merge pull request #10252 from Roasbeef/v0-20-0-rc1-branch
build: bump version to v0.20.0 rc1
2025-09-29 20:33:59 -07:00
Olaoluwa Osuntokun b0314e1ce7 build: bump version to v0.20.0 rc1 2025-09-26 18:46:29 -07:00
Olaoluwa Osuntokun 641456e216 Merge pull request #10128 from Roasbeef/iter-chan-updates
multi: update ChanUpdatesInHorizon and NodeUpdatesInHorizon to return iterators (iter.Seq[T])
2025-09-26 18:36:44 -07:00
Olaoluwa Osuntokun 506c3d5b0d docs/release-notes: add release notes entry 2025-09-26 17:02:11 -07:00
Olaoluwa Osuntokun f3a8fd842d graph+discovery: update graph/db gossip backlog interfaces to use iter.Seq2
This lets us emit a rich error if things fail when first creating the
iterator, or if any of the yield attempts fail.
2025-09-26 17:01:11 -07:00
Olaoluwa Osuntokun 0b3816afb9 discovery/test: update mock to support iterator-based UpdatesInHorizon
In this commit, we update the mockChannelGraphTimeSeries to implement
the new iterator-based UpdatesInHorizon interface. The mock maintains
its existing behavior of receiving messages through a channel and
returning them to the caller, but now wraps this in an iterator
function.

The implementation creates an iterator that pulls the entire message
slice from the mock's response channel, then yields each message
individually. This preserves the test semantics while conforming to the
new interface, ensuring all existing tests continue to pass without
modification.
2025-09-26 17:00:41 -07:00
Olaoluwa Osuntokun 77f3b35640 discovery: update ApplyGossipFilter to use lazy iterator with Pull2
In this commit, we update ApplyGossipFilter to leverage the new
iterator-based UpdatesInHorizon method. The key innovation here is using
iter.Pull2 to create a pull-based iterator that allows us to check if
any updates exist before launching the background goroutine.

This approach provides several benefits over the previous implementation.
First, we avoid the overhead of launching a goroutine when there are no
updates to send, which was previously unavoidable without materializing
the entire result set. Second, we maintain lazy loading throughout the
sending process, only pulling messages from the database as they're
needed for transmission.

The implementation uses Pull2 to peek at the first message, determining
whether to proceed with sending updates. If updates exist, ownership of
the iterator is transferred to the goroutine, which continues pulling
and sending messages until exhausted. This design ensures memory usage
remains bounded regardless of the number of updates being synchronized.
2025-09-26 17:00:11 -07:00
Olaoluwa Osuntokun d8f6fd29f7 discovery: convert UpdatesInHorizon to return iter.Seq2[lnwire.Message, error]
In this commit, we complete the iterator conversion work started in PR
10128 by threading the iterator pattern through to the higher-level
UpdatesInHorizon method. This change converts the method from returning
a fully materialized slice of messages to returning a lazy iterator that
yields messages on demand.

The new signature uses iter.Seq2 to allow error propagation during
iteration, eliminating the need for a separate error return value. This
approach enables callers to handle errors as they occur during iteration
rather than failing upfront.

The implementation now lazily processes channel and node updates,
yielding them as they're generated rather than accumulating them in
memory. This maintains the same ordering guarantees (channels before
nodes) while significantly reducing memory pressure when dealing with
large update sets during gossip synchronization.
2025-09-26 16:59:41 -07:00
Olaoluwa Osuntokun fda989da9c discovery+graph: update callers to use new iterator APIs
In this commit, we update all callers of NodeUpdatesInHorizon and
ChanUpdatesInHorizon to use the new iterator-based APIs. The changes
use fn.Collect to maintain existing behavior while benefiting from the
memory efficiency of iterators when possible.
2025-09-26 16:59:11 -07:00
Olaoluwa Osuntokun 32528afa0a graph/db: add tests for iterator implementations 2025-09-26 16:58:41 -07:00
Olaoluwa Osuntokun 31ab2ae4b6 sqldb: implement iterator support for ChanUpdatesInHorizon
In this commit, we update the SQL store implementation to support the
new iterator-based API for ChanUpdatesInHorizon. This includes adding
SQL query pagination support and helper functions for efficient batch
processing.

The SQL implementation uses cursor-based pagination with configurable
batch sizes, allowing efficient iteration over large result sets without
loading everything into memory. The query is optimized to use indexes
effectively and minimize database round trips.

New SQL query GetChannelsByPolicyLastUpdateRange is updated to support:
- Cursor-based pagination using (max_update_time, id) compound cursor
- Configurable batch sizes via MaxResults parameter
- Efficient batch caching with updateChanCacheBatch helper
2025-09-26 16:58:11 -07:00
Olaoluwa Osuntokun c69971c20b sqldb: implement iterator support for NodeUpdatesInHorizon
In this commit, we update the SQL store implementation to support the
new iterator-based API for NodeUpdatesInHorizon. This includes adding a
new SQL query that supports efficient pagination through result sets.

The SQL implementation uses cursor-based pagination with configurable
batch sizes, allowing efficient iteration over large result sets without
loading everything into memory. The query is optimized to use indexes
effectively and minimize database round trips.

New SQL query GetNodesByLastUpdateRange is updated to support:
  * Cursor-based pagination using (last_update, pub_key) compound cursor
  * Optional filtering for public nodes only
  * Configurable batch sizes via MaxResults parameter
2025-09-26 16:57:41 -07:00
Olaoluwa Osuntokun 069888b51a graph/db: convert ChanUpdatesInHorizon to use iterators
In this commit, we refactor the ChanUpdatesInHorizon method to return
an iterator instead of a slice. This change significantly reduces
memory usage when dealing with large result sets by allowing callers to
process items incrementally rather than loading everything into memory
at once.
2025-09-26 16:57:11 -07:00
Olaoluwa Osuntokun 1d6d54e5db graph/db: convert NodeUpdatesInHorizon to use iterators
In this commit, we refactor the NodeUpdatesInHorizon method to return
an iterator instead of a slice. This change significantly reduces
memory usage when dealing with large result sets by allowing callers to
process items incrementally rather than loading everything into memory
at once.

The new implementation uses Go 1.23's iter.Seq type to provide a
standard iterator interface. The method now supports configurable batch
sizes through functional options, allowing fine-tuned control over
memory usage and performance characteristics.

Rather than reading all the entries from disk into memory (before this
commit, we did consult the cache for most entries, skipping the disk
hits), we now expose a chunked iterator instead.

We also make the process of filtering out public nodes first class. This
saves many newly created db transactions later.
2025-09-26 16:56:41 -07:00
Olaoluwa Osuntokun f8ce00b84a graph/db: add options infrastructure for iterator configuration
In this commit, we introduce a new options pattern for configuring
iterator behavior in the graph database. This includes configuration
for batch sizes when iterating over channel and node updates, as well
as an option to filter for public nodes only.

The new functional options pattern allows callers to customize iterator
behavior without breaking existing APIs. Default batch sizes are set to
1000 entries for both channel and node updates, which provides a good
balance between memory usage and performance.
2025-09-26 16:56:20 -07:00
Olaoluwa Osuntokun 015875e455 fn: add Collect+CollertErr function for iterators
In this commit, we introduce a new utility function `Collect` to the fn
package. This function drains all elements from an iterator and returns
them as a slice. This is particularly useful when transitioning from
iterator-based APIs to code that expects slices, allowing for gradual
migration to the new iterator patterns.

The fn module's go.mod is also updated to require Go 1.23, which is
necessary for the built-in iter.Seq type support.

The replace directive will be removed once the fn package changes are
merged and a new version is tagged.
2025-09-26 16:55:46 -07:00
Olaoluwa Osuntokun df46d18626 Merge pull request #10182 from GeorgeTsagk/aux-feature-bits
Aux feature bits
2025-09-24 18:26:35 -07:00
Olaoluwa Osuntokun 8be5de6185 Merge pull request #10183 from Roasbeef/brontide-static-alloac
brontide: eliminate all allocations from WriteMessage+Flush
2025-09-24 15:49:05 -07:00
Olaoluwa Osuntokun 4c737d3f02 brontide+peer: use internal sync/pool to reduce allocations
This ensures that under medium to high load, we eliminate all
allocations once we arrive a steady state, re working memory.
2025-09-24 11:52:01 -07:00
Olaoluwa Osuntokun f968206849 docs: add docs explaining usage of pprof+benchmarks to optimize
In this commit, we add some docs that explain how to use tools like
heap escape analysis and memory profiling to fully eliminate allocations
in a sample program.

This guide is meant to help devs/contributors use Go's excellent perf
tools to zoom in on an optimization problem.
2025-09-24 11:52:01 -07:00
Olaoluwa Osuntokun 83e2811903 brontide: use a static buffer for the packet length
In this commit, we eliminate the final allocation that takes place when
we write out messages. Once again this was escaping to the heap, so we
make it an attribute on the Machine struct, which allows pure static
allocation.

```
goos: darwin
goarch: arm64
pkg: github.com/lightningnetwork/lnd/brontide
cpu: Apple M4 Max
BenchmarkWriteMessage-16    	   25840	     46376 ns/op	       2 B/op	       0 allocs/op
BenchmarkWriteMessage-16    	   25646	     46672 ns/op	       2 B/op	       0 allocs/op
BenchmarkWriteMessage-16    	   25874	     46391 ns/op	       2 B/op	       0 allocs/op
BenchmarkWriteMessage-16    	   25512	     46427 ns/op	       2 B/op	       0 allocs/op
BenchmarkWriteMessage-16    	   25760	     46309 ns/op	       2 B/op	       0 allocs/op
BenchmarkWriteMessage-16    	   25789	     46520 ns/op	       2 B/op	       0 allocs/op
BenchmarkWriteMessage-16    	   25602	     46619 ns/op	       2 B/op	       0 allocs/op
BenchmarkWriteMessage-16    	   25766	     46464 ns/op	       2 B/op	       0 allocs/op
BenchmarkWriteMessage-16    	   25820	     46487 ns/op	       2 B/op	       0 allocs/op
BenchmarkWriteMessage-16    	   25634	     46553 ns/op	       2 B/op	       0 allocs/op
PASS
ok  	github.com/lightningnetwork/lnd/brontide	16.907s
```
2025-09-24 11:52:01 -07:00
Olaoluwa Osuntokun 1fe156f2f4 brontide: use a fixed size buffer for the nonce within the brontide machine
In this commit, we use a fixed sized buffer for the nonce when we
read/write messages. This was actually escaping to the heap. We can
avoid this by statically allocating it alongside the struct itself.

The benchmark state at this point:

```
goos: darwin
goarch: arm64
pkg: github.com/lightningnetwork/lnd/brontide
cpu: Apple M4 Max
BenchmarkWriteMessage-16    	   25264	     47012 ns/op	       4 B/op	       1 allocs/op
BenchmarkWriteMessage-16    	   23542	     46809 ns/op	       4 B/op	       1 allocs/op
BenchmarkWriteMessage-16    	   25989	     47256 ns/op	       4 B/op	       1 allocs/op
BenchmarkWriteMessage-16    	   25542	     46388 ns/op	       4 B/op	       1 allocs/op
BenchmarkWriteMessage-16    	   26083	     46612 ns/op	       4 B/op	       1 allocs/op
BenchmarkWriteMessage-16    	   25860	     46367 ns/op	       4 B/op	       1 allocs/op
BenchmarkWriteMessage-16    	   24967	     46748 ns/op	       4 B/op	       1 allocs/op
BenchmarkWriteMessage-16    	   26088	     46485 ns/op	       4 B/op	       1 allocs/op
BenchmarkWriteMessage-16    	   25561	     46425 ns/op	       4 B/op	       1 allocs/op
BenchmarkWriteMessage-16    	   25474	     47249 ns/op	       4 B/op	       1 allocs/op
PASS
ok  	github.com/lightningnetwork/lnd/brontide	16.911s
```

```
goos: darwin
goarch: arm64
pkg: github.com/lightningnetwork/lnd/brontide
cpu: Apple M4 Max
                │   old.txt   │              new2.txt              │
                │   sec/op    │   sec/op     vs base               │
WriteMessage-16   50.34µ ± 1%   46.68µ ± 1%  -7.28% (p=0.000 n=10)

                │    old.txt     │              new2.txt              │
                │      B/op      │    B/op     vs base                │
WriteMessage-16   73788.000 ± 0%   4.000 ± 0%  -99.99% (p=0.000 n=10)

                │  old.txt   │              new2.txt              │
                │ allocs/op  │ allocs/op   vs base                │
WriteMessage-16   5.000 ± 0%   1.000 ± 0%  -80.00% (p=0.000 n=10)
```
2025-09-24 11:52:01 -07:00
Olaoluwa Osuntokun 06826f85d8 brontide: add new maxMessageSize variable 2025-09-24 11:52:01 -07:00
Olaoluwa Osuntokun 6e0083a369 brontide: add benchark for WriteMessage
In this commit, we add a benchmark for the WriteMessage method. This is
the first step in an upcoming optimizooor series of commits.

The baseline is:
```
goos: darwin
goarch: arm64
pkg: github.com/lightningnetwork/lnd/brontide
cpu: Apple M4 Max
BenchmarkWriteMessage-16    	   22736	     50667 ns/op	   73788 B/op	       5 allocs/op
BenchmarkWriteMessage-16    	   23217	     50463 ns/op	   73788 B/op	       5 allocs/op
BenchmarkWriteMessage-16    	   24241	     49941 ns/op	   73788 B/op	       5 allocs/op
BenchmarkWriteMessage-16    	   23574	     51021 ns/op	   73788 B/op	       5 allocs/op
BenchmarkWriteMessage-16    	   23784	     49926 ns/op	   73788 B/op	       5 allocs/op
BenchmarkWriteMessage-16    	   24230	     50538 ns/op	   73788 B/op	       5 allocs/op
BenchmarkWriteMessage-16    	   24058	     49971 ns/op	   73788 B/op	       5 allocs/op
BenchmarkWriteMessage-16    	   23762	     50224 ns/op	   73788 B/op	       5 allocs/op
BenchmarkWriteMessage-16    	   24266	     53034 ns/op	   73788 B/op	       5 allocs/op
BenchmarkWriteMessage-16    	   23317	     50045 ns/op	   73788 B/op	       5 allocs/op
PASS
ok  	github.com/lightningnetwork/lnd/brontide	17.433s
```
2025-09-24 11:51:59 -07:00
Olaoluwa Osuntokun 221c3e8240 Merge pull request #10188 from Roasbeef/logclosure-errwhere
multi: attempt to more uniformly use SpewLogClosure across project
2025-09-07 21:09:55 -07:00
Olaoluwa Osuntokun 63a6ae502a docs: add docs for EstimateRouteFee 2025-09-05 18:32:50 -07:00
Olaoluwa Osuntokun f77cd51671 autopilot+funding+rpc+invoices: complete migration to lazy debug logging
In this commit, we complete the migration to lnutils.SpewLogClosure for
the remaining application-layer components. This includes the autopilot
channel management system, the funding manager, the RPC server, and the
invoice storage subsystem.
2025-09-05 18:20:52 -07:00
Olaoluwa Osuntokun 2cc4079a0e routing+htlcswitch+discovery+peer+netann: optimize debug logging with lazy evaluation
In this commit, we update the network and routing layer components to use
lnutils.SpewLogClosure for debug logging.
2025-09-05 18:20:51 -07:00
Olaoluwa Osuntokun 77f2d8a572 contractcourt+sweep+watchtower: use lnutils.SpewLogClosure for debug logging
In this commit, we update the contractcourt, sweep, and watchtower
packages to use lnutils.SpewLogClosure instead of directly calling
spew.Sdump in logging statements.
2025-09-05 18:20:51 -07:00
Olaoluwa Osuntokun 6e21bc5764 lnwallet: replace spew.Sdump with lnutils.SpewLogClosure for lazy evaluation
In this commit, we replace all instances of spew.Sdump in the lnwallet
package and its subpackages with lnutils.SpewLogClosure. This change
ensures that expensive debug dump operations are only performed when the
log level actually requires them.
2025-09-05 18:20:49 -07:00
Olaoluwa Osuntokun 33406bc6f8 build: make special label checks auto-pass instead of skip
In this commit, we revamp the way our skip-labels worked to instead mark
certain stages as green, instead of skipping them. Skipped changes
didn't count towards the set of required checks, which slowed down PR
velocity.

Previously, when PRs were labeled with 'no-itest' or 'no-changelog',
the corresponding CI jobs would be completely skipped. This caused the
GitHub checks to show as skipped rather than successful, which could
be confusing and prevented certain merge rules from working properly.

This commit changes the behavior so that these jobs still run but
immediately report success when the special labels are detected. Each
affected job now starts with a label check step that sets a skip
flag, and all subsequent steps are conditionally executed based on
this flag. When skipped, the jobs add a notice to the GitHub step
summary explaining that tests were auto-passed due to the label.

The change affects five jobs: basic-integration-test, integration-test,
windows-integration-test, macos-integration-test, and milestone-check.
2025-09-03 16:09:31 -07:00
Olaoluwa Osuntokun d5f70c0ae3 Merge pull request #10184 from ellemouton/gemini-char-wrap
.gemini: ignore char wrapping during code review
2025-09-01 23:40:06 +01:00
Olaoluwa Osuntokun 8810793e61 Merge pull request #9871 from GeorgeTsagk/htlc-noop-add
Add `NoopAdd` HTLCs
2025-08-12 11:56:04 -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
Olaoluwa Osuntokun 0eacd07c60 Merge pull request #10107 from ellemouton/fixLogLevelInheritance
go.mod: bump btclog v2 version
2025-07-29 12:29:52 -04:00
Olaoluwa Osuntokun 2e36f9b8b9 Merge pull request #10096 from yyforyongyu/increase-gossip-default
Increase the default outgoing bandwidth
2025-07-25 15:34:01 -05:00
Olaoluwa Osuntokun f09c7aee4e Merge pull request #10095 from guggero/remove-old-keys
scripts/keys: remove old expired or revoked keys
2025-07-21 11:10:43 -05:00
Olaoluwa Osuntokun 47e9f05ddf Merge pull request #10027 from yyforyongyu/dyn-bigsize-msg
Fix `ExtraData` field and use `BigSize` encodine
2025-07-16 10:56:30 -07:00
Olaoluwa Osuntokun 9059a4e7ba Merge pull request #10080 from ellemouton/graphPrefixTables
sqldb+graph/db: prefix graph SQL objects with "graph_"
2025-07-15 15:21:02 -07:00
Olaoluwa Osuntokun 4fef0f4d7a Merge pull request #10001 from yyforyongyu/finalize-stfu
Enable quiescence in production and add timeout config
2025-07-09 19:01:48 -07:00
Olaoluwa Osuntokun fb68f36acb Merge pull request #10048 from ziggie1984/fix-utxonursery-encoding
contractcourt: fix encoding
2025-07-08 16:55:40 -07:00
Olaoluwa Osuntokun d40ac4564b Merge pull request #10044 from ziggie1984/fix-shutdown-issue
Fix Shutdown deadlock in some scenarios
2025-07-08 16:53:30 -07:00
Olaoluwa Osuntokun b3eb9a3cb7 Merge pull request #10028 from ffranr/export-notifier-options
chainntnfs: export NotifierOptions and internal field for interface use
2025-07-03 13:28:08 -07:00
Olaoluwa Osuntokun 7be45c3c42 Merge pull request #10013 from Roasbeef/gemini-review
CI: add config.yaml for gemini code review
2025-07-01 16:52:51 -07:00
Olaoluwa Osuntokun 7af4a18e3a CI: add config.yaml for gemini code review
So far, most of the AI code review tools I've seen in the wild have been
pretty lackluster. I figure we should give the new Gemini Code Assist
variant a try: https://github.com/marketplace/gemini-code-assist/.

This PR adds an initial yaml config for it.

Relevant commands (as comments on the OP PR):
  *  `/gemini review` to perform a code review
  *  `/gemini summary` provides a code summary
  * comment like normal tagging `@gemini-code-assist`
  * `/gemini help`
2025-06-30 16:08:46 -07:00
Olaoluwa Osuntokun 3493b08785 Merge pull request #9978 from ziggie1984/fix-peer-connection
multi: fix deadlock in p2p race condition
2025-06-25 17:36:40 -07:00
Olaoluwa Osuntokun 5f00be2b8c Merge pull request #9148 from ProofOfKeags/lnwire-dyncomms-update
DynComms [2/n]: lnwire: add authenticated wire messages for Dyn*
2025-06-25 17:16:36 -07:00
Olaoluwa Osuntokun 45c15646c6 Merge pull request #9945 from ziggie1984/optional-migration
Decayed log optional migration
2025-06-23 16:17:31 -07:00
Olaoluwa Osuntokun faa68a220e Merge pull request #9880 from yyforyongyu/accessman
Improve access control in peer connections
2025-06-20 15:26:24 -07:00
Olaoluwa Osuntokun 1756f40b36 Merge pull request #9929 from yyforyongyu/fix-decalylog
htlcswitch: remove the bucket `batchReplayBucket`
2025-06-20 14:58:45 -07:00
Olaoluwa Osuntokun 168d63ce37 Merge pull request #9528 from Roasbeef/res-opt
fn: implement ResultOpt type for operations with optional values
2025-06-18 18:22:11 -07:00
Olaoluwa Osuntokun (aider) 0c25bd3f19 fn: implement ResultOpt type for operations with optional values
This commit introduces the ResultOpt type, which represents an operation
that can either succeed with an optional final value or fail with an
error.

The .gitignore file is also updated to exclude specific files related to
the `aider` tool.
2025-06-18 18:16:24 -07:00
Olaoluwa Osuntokun 35102e7c35 Merge pull request #9652 from Roasbeef/rbf-iteration-loop-flake
lnwallet/chancloser: fix flake in TestRbfCloseClosingNegotiationLocal
2025-06-11 14:08:19 -07:00
Olaoluwa Osuntokun da8d2257fd build: bump version to v0.19.99 2025-06-11 12:03:18 -07:00
Olaoluwa Osuntokun c33fbfb3e7 Merge pull request #9928 from ellemouton/removeModReplaces
go.mod: remove tlv and sqldb replace directives
2025-06-11 12:01:08 -07:00
Olaoluwa Osuntokun 07f65b5118 Merge pull request #9923 from ellemouton/graphCache
graph/db: only fetch required info for graph cache population
2025-06-11 10:57:45 -07:00
Olaoluwa Osuntokun eb863e46af lnwallet/chancloser: fix fllake in TestRbfCloseClosingNegotiationLocal/send_offer_rbf_wrong_local_script
In this commit, we fix a flake in the
`TestRbfCloseClosingNegotiationLocal/send_offer_rbf_wrong_local_script`
test.

This flake can happen if the test shuts down _before_ the state machine
is actually able to process the sent event. In this case, the
expectations are triggered, and we find that the error isn't sent.

To resolve this, we create a new wrapper function that'll use a sync
channel send to assert that the error has been sent before we exit the
test.
2025-06-10 18:44:34 -07:00
Olaoluwa Osuntokun 92a5d35cff Merge pull request #9911 from ziggie1984/exit-early-for-fwd-adds
htlcswitch: exit early if no adds are in the fwd pkg
2025-06-10 15:14:09 -07:00
Olaoluwa Osuntokun 32592dbd20 Merge pull request #9897 from ellemouton/inboundFeeTLV
multi: explicitly define InboundFees in ChannelUpdate and ChannelEdgePolicy
2025-06-10 11:05:48 -07:00
Olaoluwa Osuntokun c6d6d4c0b6 Merge pull request #9913 from yyforyongyu/debug-switch
htlcswitch+lntest: add more debug logs
2025-06-06 12:34:40 -07:00
Olaoluwa Osuntokun 89881414e6 Merge pull request #9726 from Roasbeef/protofsm-full-block-conf
protofsm: add option to allow conf resp to return full block
2025-06-03 16:41:22 -07:00
Olaoluwa Osuntokun 3f03752b25 protofsm: add test for new full block conf behavior 2025-06-03 16:39:48 -07:00
Olaoluwa Osuntokun 4908d76653 protofsm: add option to allow conf resp to return full back
In this commit, we add an option to allow a conf req caller to receive
the full block. This is useful if the caller wants to be able to create
an SPV proof.
2025-06-03 16:39:48 -07:00
Olaoluwa Osuntokun a8930773a4 Merge pull request #9725 from Roasbeef/protofsm-conf-mapper
protofsm: add ConfMapper to allow conf attribute projection for new events
2025-06-03 16:28:01 -07:00
Olaoluwa Osuntokun 946ae4c804 protofsm: add generic type assertion to state machine tests
This commit introduces a new generic type assertion function
`assertState` to the state machine tests. This function asserts that the
state machine is currently in the expected state type and returns the
state cast to that type. This allows us to directly access the fields of
the state without having to perform a type assertion manually.
2025-06-03 16:27:30 -07:00
Olaoluwa Osuntokun c580666e28 protofsm: add unit tests for SpendMapper 2025-06-03 16:27:30 -07:00
Olaoluwa Osuntokun cb46f3daa0 protofsm: add new ConfMapper similar to SpendMapper for conf events
In this commit, we add a new ConfMapper which is useful for state
machines that want to project some of the conf attributes into a new
event to be sent post conf.
2025-06-03 16:27:28 -07:00
Olaoluwa Osuntokun f8e67c0bcd Merge pull request #9872 from ziggie1984/fix-peer-connection
brontide: fix peer disconnection issue
2025-06-02 11:53:35 -07:00
Olaoluwa Osuntokun 03b35d000e peer+feature: start to signal the prod rbf coop close bit
In this commit, we start to signal the prod bit for the rbf coop close
feature. We keep our signaling of the staging bit in place to ensure
the protocol continues to work between those nodes in the wild that are
still signaling the bit.

Fixes https://github.com/lightningnetwork/lnd/issues/9852
2025-05-23 13:54:42 -07:00