Commit Graph

19564 Commits

Author SHA1 Message Date
Abdullahi Yunus
36dfed1cba fn: add benchmark for Map and ForEachConc fns 2025-07-09 21:21:45 +01:00
yyforyongyu
52d963bae0 itest+lntest: fix flake in testListSweeps
We now make sure we assert the `ListSweeps` results in a wait closure.
2025-07-09 20:52:02 +03:00
Oliver Gugger
0e830da9d9 Merge pull request #10058 from ellemouton/fix/rpc-graph-cache-race
rpcserver: fix race condition in graph cache eviction
2025-07-09 17:09:38 +02:00
Oliver Gugger
10209b9301 Merge pull request #10059 from ellemouton/geminiStyle
.gemini: add styleguide.md
2025-07-09 17:08:46 +02:00
Elle Mouton
b62793ada8 .gemini: add styleguide.md
Add a styleguide for gemini derived from docs/development_guidelines.md.
2025-07-09 16:22:32 +02:00
Oliver Gugger
ea32aac770 Merge pull request #10050 from ellemouton/graphMig2-channels
[graph mig 2]: graph/db: migrate graph channels and policies from kvdb to SQL
2025-07-09 13:09:27 +02:00
Elle Mouton
ef181adbc8 rpcserver: fix race condition in graph cache eviction
The previous implementation of the graph cache evictor used
time.AfterFunc, which introduced a race condition. The closure
passed to AfterFunc could execute before the call returned and
assigned the timer to the r.graphCacheEvictor field.

This created a scenario where the closure would attempt to call
Reset() on a nil r.graphCacheEvictor, causing a panic.

This commit fixes the race by replacing time.AfterFunc with a
more robust pattern using time.NewTimer and a dedicated goroutine.
The new timer is created and assigned immediately, ensuring that
r.graphCacheEvictor is never nil when accessed.

The dedicated goroutine now safely manages the timer's lifecycle,
resetting it upon firing and stopping it gracefully upon server
shutdown, which also prevents goroutine leaks.
2025-07-09 11:56:09 +02:00
Elle Mouton
640caeff39 docs: add release notes entry 2025-07-09 10:18:57 +02:00
Elle Mouton
b58089049a graph/db: migrate channels and polices to SQL
In this commit, the `MigrateGraphToSQL` function is expanded to migrate
the channel and channe policy data. Both of these have the special case
where the kvdb store records may contain invalid TLV. If we encounter a
channel with invalid TLV, we skip it and its policies. If we encounter a
policy with invalid TLV, we skip it.

The `TestMigrateGraphToSQL` and `TestMigrationWithChannelDB` tests are
updated accordingly.
2025-07-09 10:18:57 +02: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
ziggie
354585e9dc docs: add release-notes 2025-07-08 20:10:31 +02:00
ziggie
7a363ee17f chanbackup: fix shutdown issue when backuper has not started yet 2025-07-08 20:10:31 +02:00
Oliver Gugger
47dce08948 Merge pull request #10018 from yyforyongyu/minor-refactor-link
Refactor link's long methods
2025-07-08 19:51:04 +02:00
ziggie
9bff22864e docs: add release notes 2025-07-08 19:16:28 +02:00
ziggie
1b675273fe contractcourt: fix encoding 2025-07-08 19:16:28 +02:00
Oliver Gugger
df1a15f0f1 Merge pull request #10041 from ziggie1984/fix-fwd-pkg-garbage-collection
channeldb: gc fwd packgages which have zero ADDs
2025-07-08 18:30:47 +02:00
Elle Mouton
793c1057bb graph: remove one context.TODO
By threading a context through to the Builder's ForAllOutgoingChannels
method.
2025-07-08 15:11:02 +02:00
Elle Mouton
3d5e852c8c graph/db: let ForEachNodeCached take a context 2025-07-08 15:11:02 +02:00
Elle Mouton
1e804a3d5f graph/db: let ForEachNode take a context 2025-07-08 15:11:02 +02:00
Elle Mouton
f05ef2db97 graph/db: let ForEachNodeCacheable take a context 2025-07-08 15:10:30 +02:00
Elle Mouton
85fda8b926 routing+server: let ForAllOutgoingChannels take a context
And so, remove a previously added context.TODO
2025-07-08 15:10:30 +02:00
Elle Mouton
046e106a17 graph/db: let ForEachChannel take a context 2025-07-08 15:10:30 +02:00
Elle Mouton
f8d3a3f3ba graph/db: let ForEachNodeChannel take a context 2025-07-08 15:10:30 +02:00
Elle Mouton
67c0f54e13 graph/db+server: let ForEachSourceNodeChannel take a context 2025-07-08 15:10:30 +02:00
Elle Mouton
792970e50c server: create call-back helper forEachSrcNodeChan
We do this so that in an upcoming commit, we can expand the param list
of the call-back without adding another indent to the call-back code.
2025-07-08 15:10:30 +02:00
Elle Mouton
6295211d1a server: use errors.Is for error comparison 2025-07-08 15:10:29 +02:00
Elle Mouton
61c1d258c3 graph/db: factor out helper code
Here we factor out some of the crud code in TestEdgePolicyMissingMaxHtcl
so that we can re-use it later on.
2025-07-08 14:30:14 +02:00
Elle Mouton
0162ee949c graph/db: move TLV validation for KVStore
Here, we move TLV validation for the KVStore out of `updateEdgePolicy`
so that we can re-use `updateEdgePolicy` in our tests to write policies
with invalid TLV (since that was possible before the recently added TLV
sanity check) so that we can test that our SQL migration behaves
correctly for these cases.
2025-07-08 14:28:45 +02:00
Oliver Gugger
886ccd3f9b Merge pull request #10042 from ziggie1984/debug-sending-payment-failure
routing: add logs to debug potential payment sending issue
2025-07-08 14:15:50 +02:00
Elle
11f6648527 Merge pull request #10036 from ellemouton/graphMig1-nodes
[graph mig 1]: graph/db: migrate graph nodes from kvdb to SQL
2025-07-08 14:15:18 +02:00
ziggie
eb4c87cdcb routing: return error for getBandwidth and log it 2025-07-08 11:41:15 +02:00
Elle Mouton
cb959bddb0 docs: add release note 2025-07-08 11:37:44 +02:00
Elle Mouton
9657707175 graph/db: migrate source node to SQL store 2025-07-08 11:37:41 +02:00
Elle Mouton
8b2f4821d4 graph/db: migrate nodes to SQL store
This commit expands MigrateGraphToSQL so that it migrates all the graph
nodes from kvdb to SQL.

The TestMigrateGraphToSQL test is updated to cover the basic
LightningNode cases. A new test, `TestSQLMigrationEdgeCases`, is also
added and a case is added to tests the edge case where a node exists in
our kvdb store that has invalid TLV bytes.
2025-07-08 11:37:39 +02:00
ziggie
9a75400295 multi: add logs to debug potential payment sending issue 2025-07-08 10:54:59 +02:00
ziggie
923cafb989 multi: revert back changes from 9911
always process remote ADDs even when they are empty to trigger
the gc process when loading them back into memory.
2025-07-08 10:25:26 +02:00
Elle Mouton
084563c5c0 sqldb+invoices: create a re-usable comparion helper function
So that we can use it for comparisons in other migrations too.
2025-07-07 18:41:46 +02:00
Oliver Gugger
b815109b81 Merge pull request #10045 from yyforyongyu/fix-panic
contractcourt: only close quit in `Stop`
2025-07-07 16:30:58 +02:00
yyforyongyu
9fb0f77d8c docs: update release docs 2025-07-07 16:01:04 +03:00
yyforyongyu
2b4c28204a contractcourt: only close quit in Stop
Make sure we don't prematurely close the `quit` chans.
2025-07-07 15:46:47 +03:00
Elle Mouton
5c09652e1a graph/db: add dev migration test helper
This commit was inspired by the invoices package
TestMigrationWithChannelDB test helper.

This test is purely for running locally to test the graph SQL migration.
It allows a dev to run the migration against a local `channel.sqlite` or
even `channel.db` file.
2025-07-07 13:35:30 +02:00
Elle Mouton
e3572e77c5 graph/db: add SQL migration function and test framework
In this commit, the basic framework for the graph SQL migration is
added. This sets us up for the commits to follow which will add
migration logic for each table in the graph commit by commit.
2025-07-07 13:34:19 +02:00
Elle Mouton
5d7abcdf03 graph/db: refactor SQL DB creation files
Factor out the transaction executor construction so that we can have
access to the raw BatchedSQLQueries type from within tests.
2025-07-07 08:36:12 +02:00
Elle Mouton
c9a775e7fb graph/db: fix build flag directive
Fix a typo in the build directive.
2025-07-07 08:36:12 +02:00
Yong
ff32e90d1d Merge pull request #10035 from ziggie1984/fix-switch-deadlock
fix switch deadlock
2025-07-04 16:35:20 +03:00
ziggie
edb7342daa docs: add release-notes 2025-07-04 13:15:20 +02:00
ziggie
68b7aaa96f switch: unlock mutex lock earlier
We now unlock the mutex lock of the switch as soon as possible to
avoid potetnial deadlock in the htlc switch.
2025-07-04 13:15:20 +02: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
yyforyongyu
bac8c51076 docs: update release notes 2025-07-04 04:20:00 +08:00