Commit Graph
19955 Commits
Author SHA1 Message Date
Elle Mouton e68bf6c58d docs: add release notes for race condition fixes 2025-12-08 11:57:01 +02:00
Elle Mouton 9f715555c4 graph/db: fix race in DisconnectBlockAtHeight cache access
The DisconnectBlockAtHeight method was modifying the rejectCache and
chanCache without holding the cacheMu lock. This caused races with
other operations that properly held the lock, such as AddChannelEdge
which modifies the caches in its OnCommit callback while the batch
scheduler holds cacheMu.

Fix by acquiring cacheMu before removing channels from the caches.
2025-12-08 11:56:36 +02:00
Elle Mouton 31b3e7424d graph/db/models: fix race conditions in ChannelEdgeInfo
Both NodeKey1 and NodeKey2 methods had the same race condition as the
Node.PubKey method, where concurrent calls could race to write to the
cached fields.

Remove the caching for the same reasons: parsing overhead is minimal
and doesn't justify the complexity and race risk.
2025-12-08 11:56:36 +02:00
Elle Mouton 9906e61774 graph/db/models: fix race condition in Node.PubKey
The PubKey method had a race condition where concurrent calls could
all pass the nil check and race to write to the cached pubKey field.
This is a classic check-then-act race.

Remove the caching entirely to fix the race. The overhead of parsing
a public key is minimal and doesn't justify the added complexity and
race risk of caching.
2025-12-08 11:56:35 +02:00
Yong a76f22da9d Merge pull request #10419 from AbelLykens/patch-2
[docs] Document use-native-sql=true for SQL migration step 2
2025-12-04 19:27:30 +08:00
AbelLykens f811805c65 docs: update sql migration guide 2025-12-04 09:34:58 +00:00
Elle 20473482d4 Merge pull request #10371 from ellemouton/fixSourceNodeSetting
graph/db: fix SetSourceNode no rows error
2025-12-03 15:34:41 +02:00
Elle Mouton 3e0bc6b18c docs: add release note 2025-12-03 13:09:22 +02:00
Elle Mouton c04aa655b9 graph/db: fix SetSourceNode race with lenient upsert
This commit fixes a race condition where multiple goroutines call
SetSourceNode concurrently during startup, causing sql.ErrNoRows
errors. The race occurs when multiple code paths (setSelfNode,
createNewHiddenService, RPC updates) read the same old timestamp,
independently increment it to the same new value (T+1), and race to
write.

The fix uses the new UpsertSourceNode SQL query (without strict
timestamp constraint) instead of UpsertNode. This allows
last-write-wins semantics for our own node, ensuring all parameter
changes persist even when timestamps collide.

Refactored sql_store.go for reusability:
- upsertNodeAncillaryData: common logic for features/addresses/extras
- populateNodeParams: common parameter building with callback pattern
- buildNodeUpsertParams: builds params for strict UpsertNode
- buildSourceNodeUpsertParams: builds params for lenient UpsertSourceNode
- upsertSourceNode: new function using lenient query

Updated TestSetSourceNodeSameTimestamp to verify that concurrent
updates with the same timestamp now succeed and parameter changes
persist.

Fixes the itest error:
"unable to upsert source node: upserting node(...): sql: no rows in
result set"
2025-12-03 13:08:31 +02:00
Elle Mouton 8349a6f84d sqldb: add UpsertSelfNode query
This query is less strict in terms of the latest update timestamp field.
We want to be less strict with our own node data since we always want
our own updates recorded.
2025-12-03 13:08:31 +02:00
Elle Mouton 41615f74a5 graph/db: add test for SetSourceNode same timestamp behavior
This commit adds TestSetSourceNodeSameTimestamp to demonstrate the
current behavior when SetSourceNode is called with the same last update
timestamp. The test reveals a difference between the SQL and bbolt
implementations:

- SQL store returns sql.ErrNoRows when attempting to update with the
  same timestamp, as the upsert query's UPDATE clause requires the new
  timestamp to be strictly greater than the existing one
- bbolt store silently ignores stale updates and returns no error

This behavior is important to document because our own node
announcements may change quickly with the same timestamp, unlike
announcements from other nodes where same timestamp typically means
identical parameters.
2025-12-03 13:08:30 +02:00
Yong 4b1c4998ad Merge pull request #10399 from mohamedawnallah/handle-partial-tls-files
tls_manager: Handle partial TLS files
2025-12-03 18:27:39 +08:00
Mohamed Awnallah 0a6f69dd7e docs: update release notes 2025-12-03 09:13:23 +00:00
Olaoluwa Osuntokun 140248ba9d Merge pull request #10383 from ziggie1984/bugfix/fix-mission-control-startup
routing: allow misson control manager to startup despite errors
2025-12-02 16:19:15 -08:00
ziggie 17b77b64a3 docs: add release-notes for LND 20.1 2025-12-02 20:38:55 +01:00
ziggie f6bc88f348 routing: allow misson control manager to startup despite errors
We now allow the mission control manager to skip over deserializable
errors. We cannot repair this these results but we just skip over
it so we can startup properly.

When fetchAll() encounters entries that fail to deserialize, in
addition to skipping them, now also:

- Delete the corrupted entries from the database
- Remove them from the in-memory keysMap and keys tracking structures

This prevents corrupted entries from:
- Being counted toward maxRecords, which would cause valid entries
  to be pruned prematurely
- Persisting in the database indefinitely
- Causing inaccurate entry counts in startup logs
2025-12-02 20:38:55 +01:00
Yong 0a2a5b29c7 Merge pull request #10394 from ziggie1984/add-back-globallock
lncfg: readd global lock for postgres and the channeldb_kv table
2025-11-28 20:19:40 +08:00
ziggie 565633578f docs: add release-notes for LND 20.1 2025-11-28 09:22:20 +01:00
ziggie 4f051d97ea lncfg+scripts: use configurable global lock for postgres backends
Replace hardcoded WithGlobalLock assignment with configurable
options wallet postgres backends. Also add the WithGlobalLock
option to the channeldb table for postgres backends.

Defaults:
- channeldb: false (allow concurrent access)
- wallet: true (maintain safe single-writer behavior)

Users can now override these defaults via:
- db.postgres.channeldb-with-global-lock
- db.postgres.walletdb-with-global-lock

This gives operators flexibility while maintaining safe defaults
until full native SQL migration is complete.

Moreover exclude db.postgres.walletdb-with-global-lock check
in the sample config file script. We cannot easily check the
correct default because we set it later in the LND startup
sequence so we exclude it.
2025-11-28 09:22:19 +01:00
ziggie 2e16efed30 sqldb: add global lock config options for postgres
Add two configuration options to control global lock usage for
different postgres database backends:

- ChannelDBWithGlobalLock: for channeldb access (default: false)
- WalletDBWithGlobalLock: for wallet database access (default: true)

These allow fine-grained control over which databases use global
locks, rather than hardcoding the behavior. This is a temporary
measure until the revocation log and wallet are migrated to native
SQL and become fully concurrent-safe.
2025-11-28 09:22:19 +01:00
Thiago Romão Barcala c7fe6425f3 tls_manager.go: handle case when either TLS pair files exist 2025-11-27 13:33:14 +00:00
Mohamed Awnallah c9dea6d621 tls_manager_test.go: reproduce partial tls files handling
When there is only one of the tls pairs (key/certificate) and the
other is missing, the TLS manager currently assumes it exists
and ignore generating them. This results in error propgated to user
that the other tls pair file is missing/not found.
2025-11-27 13:33:06 +00:00
Yong 85a5bf294c Merge pull request #10341 from bitromortac/2511-fix-tor-healthcheck
server: prevent duplicate onion addresses in getinfo
2025-11-27 18:40:27 +08:00
bitromortac b513efc5c1 docs: add release-notes for lnd v0.20.1 2025-11-26 16:58:45 +01:00
bitromortac 031903f275 server: ensure unique addresses for node ann
Modifiers of the node announcement may add duplicate addresses, which we
remove here after the modifications were applied. This also ensures that
any previously added duplicate addresses are removed as well.
2025-11-26 16:56:07 +01:00
Yong c746aeed31 Merge pull request #10391 from ffranr/wip/add-field-committxblockheight-to-resolutionreq
lnwallet: add field `CommitTxBlockHeight` to `ResolutionReq`
2025-11-26 10:50:53 +08:00
ffranr 3d2b0d703e lnwallet: add field CommitTxBlockHeight to ResolutionReq
Introduce `CommitTxBlockHeight` field to the `ResolutionReq` structure
and related methods. This field records the block height where a
commitment transaction has confirmed.
2025-11-25 17:06:18 +00:00
Olaoluwa Osuntokun 7e70e3dbd8 Merge pull request #10387 from ziggie1984/fix-scanning-issue
fix scanning issue
2025-11-24 10:09:48 -08:00
ziggie db3add1c9c docs: add release-notes for LND 20.1 2025-11-22 01:19:44 +01:00
ziggie 79b92a9fa3 contractcourt: use confheight instead of rescanning the chain 2025-11-22 01:19:43 +01:00
ziggie 5538803252 contracourt: fix comment 2025-11-22 01:17:38 +01:00
ziggie 8824244656 contracourt: rename broadcastHeight to confirmHeight
The broadcastHeight was misleading because the commit resolver
is only created when the commitment transaction is confirmed.
2025-11-22 01:17:34 +01:00
Yong 8c8662c86a Merge pull request #10384 from starius/rm-dead-code
lncli: remove dead code
2025-11-20 16:09:02 +08:00
Boris Nagaev 031c792b56 lncli: remove dead code
Variable chanPoints was accumulated but never used. Found with staticcheck tool.

The code is dead since 8f5d78c875
2025-11-19 21:51:40 -03:00
András Bánki-Horváth 194a9f7597 Merge pull request #10378 from ziggie1984/bugfix/graph-cache
graph: fix graph-cache issue
2025-11-19 18:01:31 +01:00
ziggie 4f40d45d06 docs: add release-notes for 20.1 2025-11-19 16:09:33 +01:00
ziggie 5225b9bbbc graph: add regression test for the fixed behaviour 2025-11-19 16:09:33 +01:00
ziggie 575766c5f4 graph: fix graph cache population for channels with both policies disabled
Fix a bug where channels with both policies disabled were not added to
the graph cache during startup. When a policy update later re-enabled
one of the directions, the update would succeed in the database but fail
to update the graph cache (since the channel structure was never added),
preventing the channel from being used for routing.
2025-11-19 10:12:08 +01:00
Yong 31452a66a5 Merge pull request #10374 from ziggie1984/bugfix/fix-unit-test
Fix unit test for onion messages
2025-11-17 21:25:45 +08:00
ziggie 84504fa8c5 lnwire: implement SerializedSize for onion messages 2025-11-16 09:28:12 +01:00
Yong 841a29118a Merge pull request #10310 from starius/bump-mapstructure
multi: update mapstructure/v2
2025-11-14 20:11:52 +08:00
Yong ff20dd281e Merge pull request #9432 from NishantBansal2003/close-addr-conf
multi: add upfront-shutdown-address to lnd.conf.
2025-11-14 15:54:58 +08:00
Yong bb6e8f390b Merge pull request #10366 from starius/mv-release-notes
docs: move release notes from 0.20.0 to 0.21.0
2025-11-14 15:53:04 +08:00
Boris Nagaev 86e3b1b05c docs: move release notes from 0.20.0 to 0.21.0
Remove the chain notifier RPC note from the 0.20 release notes and add it to
0.21.
2025-11-13 12:54:25 -03:00
Yong f6005ed350 Merge pull request #10352 from starius/chainnotifier-unavallable
chainrpc: return Unavailable while notifier starts
2025-11-13 23:27:52 +08:00
Nishant Bansal 36fb79ece5 docs: add release notes
Signed-off-by: Nishant Bansal <nishant.bansal.282003@gmail.com>
2025-11-13 19:34:05 +05:30
Nishant Bansal 4c3cff14f2 itest: add itest for upfront-shutdown-address config
Signed-off-by: Nishant Bansal <nishant.bansal.282003@gmail.com>
2025-11-13 19:32:51 +05:30
Nishant Bansal e4c4d946fd multi: add new config option upfront-shutdown-address
Introduced a new config value `upfront-shutdown-address`
in the `lnd.conf` file. This ensures that channel close
funds are transferred to the specified shutdown address.
The value applies to both the funder and the fundee but
can be overridden by the value specified during
`openchannel` or by the `channel acceptor`.

NOTE: If this field is set when opening a channel with a
peer that does not advertise support for upfront shutdown
feature, the channel open will fail.

Signed-off-by: Nishant Bansal <nishant.bansal.282003@gmail.com>
2025-11-13 19:32:51 +05:30
Olaoluwa Osuntokun af6816b344 Merge pull request #10343 from lightningnetwork/0-21-0-staging
Merge branch `0-21-staging`
2025-11-12 16:34:20 -08:00
Elle Mouton 95b84a89b8 docs: update release notes 2025-11-12 22:54:06 +08:00