Commit Graph

18992 Commits

Author SHA1 Message Date
Elle Mouton
b5bc9c8fbe graph/db: check for nil policies
In the graph/db code, we should always expect to deal with potentially
nil ChannelEdgePolicy pointers and so we should always do a nil check
before making use of the struct.
2025-06-20 09:07:37 +02:00
Yong
a3209a5bfa Merge pull request #9950 from starius/describegraph-authproofs2
lnrpc: add auth_proof to graph APIs
2025-06-20 14:54:03 +08:00
Boris Nagaev
409bf3c6cc docs: update release notes (include_auth_proof) 2025-06-19 18:19:33 -03:00
Boris Nagaev
7a70dcb36e lnrpc: add auth_proof to graph APIs
Added flag include_auth_proof to DescribeGraph, GetNodeInfo, GetChanInfo
and the corresponding lncli commands. With the flag, these APIs add AuthProof
(signatures from the channel announcement) to the returned ChannelEdge.

This is useful to extract this data from the DB.
2025-06-19 18:19:33 -03:00
Oliver Gugger
40efefeb6a Merge pull request #9959 from ellemouton/chanGraphContext2
multi: add context.Context param to more graphdb.V1Store methods
2025-06-19 16:42:55 +02:00
Elle Mouton
91513623b5 routing: remove a context.TODO() 2025-06-19 14:49:32 +02:00
Elle Mouton
9597f01ce3 graph/db: thread context through to HighestChanID 2025-06-19 14:49:32 +02:00
Elle Mouton
004440a86c graph/db: thread context through to LookupAlias 2025-06-19 14:49:32 +02:00
Elle Mouton
81c063eb96 graph/db: thread context through to UpdateEdgePolicy 2025-06-19 14:49:31 +02:00
Elle Mouton
3fdb9b84f4 graph/db: thread context to AddChannelEdge 2025-06-19 14:47:41 +02:00
Elle Mouton
7ba4051cfd graph/db: thread context through to SourceNode 2025-06-19 14:47:41 +02:00
Elle Mouton
65049ddd02 graph/db: thread context through to SetSourceNode 2025-06-19 14:47:40 +02:00
Oliver Gugger
e0a9705d59 Merge pull request #9935 from ellemouton/graphSQL11-forEachMethods
[11] graph/db: Implement various "ForEach" methods on the graph SQLStore
2025-06-19 10:29:42 +02: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
Elle Mouton
ece157b40b graph/db: implement ForEachNodeChannel
Which lets us then run `TestIncompleteChannelPolicies` and
`BenchmarkForEachChannel` against our SQL backends.
2025-06-18 16:55:00 +02:00
Elle Mouton
0607982886 graph/db: implement ForEachNodeDirectedChannel and ForEachNodeCacheable
Here we add the `ForEachNodeDirectedChannel` and `ForEachNodeCacheable`
SQLStore implementations which then lets us run
`TestGraphTraversalCacheable` and `TestGraphCacheForEachNodeChannel`
against SQL backends.
2025-06-18 16:55:00 +02:00
Elle Mouton
8af32951c7 graph/db+sqldb: implement ForEachNode
In this commit the `ForEachNode` method is added to the SQLStore. With
this, the `TestGraphCacheTraversal` unit test can be run against SQL
backends.
2025-06-18 16:54:59 +02:00
Elle Mouton
d60761f79c graph/db: fix error check in test
An error in TestChanUpdatesInHorizon was previously not checked
correctly.
2025-06-18 15:24:16 +02:00
Elle Mouton
973d211083 graph/db: fix DecodeHexColor
Ensure that it does a sanity check on the length of its input and also
only call it if the nullable SQL string is not null.

Expand an existing unit tests to cover the DecodeHexColor such that it
would have caught the bug.
2025-06-18 15:19:23 +02:00
Elle Mouton
23d4bfc1b0 graph/db: add comment and switch to length check
Use a length check to determine if a bitcoin signature has been set or
not. Also add a clarifying comment to explain why we only need to check
if one signature field is set to determine if we have the auth proof for
the channel or not.
2025-06-18 15:17:55 +02:00
Oliver Gugger
31c74f20fa Merge pull request #9962 from yyforyongyu/fix-panic
chainio: use package logger instead of instance logger
2025-06-18 15:09:07 +02:00
Oliver Gugger
79294dff35 Merge pull request #9931 from ellemouton/graphSQL10-forEachSourceNode
[10] graph/db+sqldb: implement ForEachSourceNodeChannel
2025-06-18 14:51:38 +02:00
yyforyongyu
b0aa4ae2de chainio: use package logger instead of instance logger
There's no guarantee that the `b.beat` is initialized when the
dispatcher shuts down, especially with the case in the remote signer
where no chainbackend is created.
2025-06-18 19:43:27 +08:00
Elle Mouton
f89e3ceced graph/db+sqldb: implement ForEachSourceNodeChannel
In this commit, the ForEachSourceNodeChannel implementation of the
SQLStore is added. Since this is the first method of the SQLStore that
fetches channel and policy info, it also adds all the helpers that are
required to do so. These will be re-used in upcoming commits as more
"For"-type methods are added.

With this implementation, we convert the `TestForEachSourceNodeChannel`
such that it is run against SQL backends.
2025-06-18 08:43:56 +02:00
Elle Mouton
3ed53cdcba graph/db: cache source node info
Save future round trips by caching source node info since this info will
never change.
2025-06-18 08:26:38 +02:00
Oliver Gugger
a27bd69b9c Merge pull request #9956 from ellemouton/chanGraphContext
multi: add `context.Context` param to some `graphdb.V1Store` methods
2025-06-17 20:34:56 +02:00
Elle Mouton
e724e1c3e4 multi: thread context through to AddrsForNode 2025-06-17 19:20:59 +02:00
Elle Mouton
d1fa5701eb graph/db: thread context through to DeleteLightningNode 2025-06-17 19:20:59 +02:00
Elle Mouton
dc6259fcc3 graph/db: thread context through to HasLightningNode 2025-06-17 19:20:56 +02:00
Elle Mouton
66c5a97202 graph/db: thread context through to FetchLightingNode 2025-06-17 19:20:27 +02:00
Elle Mouton
d1cfb47428 graph/db: thread context to AddLightningNode 2025-06-17 19:20:27 +02:00
Oliver Gugger
c1740c14ba Merge pull request #9887 from ellemouton/graphSQL9-chan-policies-schema
graph/db+sqldb: channel policy SQL schemas, queries and upsert CRUD
2025-06-17 16:30:23 +02:00
Elle Mouton
c327988bb3 graph/db+sqldb: implement UpdateEdgePolicy
In this commit, the various SQL queries are defined that we will need in
order to implement the SQLStore UpdateEdgePolicy method. Channel
policies can be "replaced" and so we use the upsert pattern for them
with the rule that any new channel policy must have a timestamp greater
than the previous one we persisted.

As is done for the KVStore implementation of the method, we use the
batch scheduler for this method.
2025-06-17 13:43:07 +02:00
Yong
a5c4a7c547 Merge pull request #9921 from yyforyongyu/fix-notification
Use spent height as the rescan start height in `RegisterSpendNtfn`
2025-06-16 20:50:53 +08:00
Oliver Gugger
207df8dd7c Merge pull request #9951 from yyforyongyu/fix-cached-policy
graph: fix nil pointer deference in `ForEachChannelCacheable`
2025-06-16 10:28:16 +02:00
Oliver Gugger
cb10536a2f Merge pull request #9943 from ziggie1984/update-lightning-onion
multi: update sphinx lib to latest version
2025-06-16 10:26:25 +02:00
Oliver Gugger
8f8d17de26 Merge pull request #9903 from ziggie1984/sphinx-relays-doc
docs: add sphinx replay description
2025-06-16 10:25:04 +02:00
Oliver Gugger
63e7c2e893 Merge pull request #9933 from Roasbeef/0-19-99
build: bump version to v0.19.99
2025-06-16 08:51:45 +02:00
Oliver Gugger
5d161e8cd0 Merge pull request #9653 from djkazic/reorder-buckets-check
channeldb: perform init of top level buckets first
2025-06-16 08:24:03 +02:00
Yong
94064bed3a Merge pull request #9815 from mohamedawnallah/preventCurrentNodeAnnMutation
server.go: prevent partial mutation of `currentNodeAnn` in `server.genNodeAnnouncement` on `netann.SignNodeAnnouncement` failures
2025-06-16 12:05:44 +08:00
yyforyongyu
46c5715ae5 graph: fix nil pointer deference in ForEachChannelCacheable 2025-06-16 12:02:24 +08:00
Mohamed Awnallah
e7d30e0790 docs: update release notes 2025-06-14 14:31:57 +00:00
Mohamed Awnallah
d26a84e18b server.go: prevent partial mutation of currNodeAnn
In this commit, we prevent partial mutation of current
node announcement during announcement signing. If node
announcement signing failed the current node announcement
becomes inconsistent.
2025-06-14 14:23:34 +00:00
Yong
fe405426ca Merge pull request #9356 from funyug/add-filters-fwdhistory
lnrpc: add incoming/outgoing channel ids filter to forwarding history request
2025-06-14 08:36:51 +08:00
ziggie
1741810065 docs: add sphinx replay description
Previouly the sphinx replay db would cause confusion for what it
is needed at all. We clarify it in a detailed document.
2025-06-13 15:37:03 +02:00
djkazic
759a870072 channeldb: perform init of top level buckets first 2025-06-13 09:02:07 -04:00
ziggie
fe3db6a263 multi: update sphinx lib to latest version 2025-06-13 08:47:31 +02:00
Elle Mouton
498a18d028 graph/db: provide SQLStore with chainhash
In this commit, we introduce a SQLStoreConfig struct which for the time
being only has the ChainHash of the genesis block of the chain this node
is running on. This is used to reconstruct lnwire messages from what we
have persisted in the DB. This means we dont need need to persist the
chain-hash of gossip messages since we know it will always be the same
for a given node. If a node were to be started with a different network,
the lnwire messages it reconstructs for gossip will be invalid.
2025-06-12 07:16:18 +02:00
Elle Mouton
4e2750e179 sqldb: channel policy tables
Define the SQL tables for representing channel policies. Namely:

- channel_policies
- channel_policy_extra_types
2025-06-12 07:16:18 +02:00