22 Commits

Author SHA1 Message Date
Elle Mouton
b624a6a74e
graph/db: remove kvdb param from test helper
Remove the kvdb.Backend parameter from the `createChannelEdge` helper.
This is all in preparation for having the unit tests run against any DB
backend.
2025-05-08 10:24:11 +02:00
Elle Mouton
6157399a56
graph/db: test clean-up
This commit cleans up the graph test code by removing unused kvdb type
parameters from the `createTextVertex` and `createLightningNode` helper
methods. We also pass in the testing parameter now so that we dont need
to check the error each time we call `createTestVertex`.
2025-05-08 10:24:11 +02:00
Elle Mouton
2221aaa889
graph/db: move Topology client management to ChannelGraph
We plan to later on add an option for a remote graph source which will
be managed from the ChannelGraph. In such a set-up, a node would rely on
the remote graph source for graph updates instead of from gossip sync.
In this scenario, however, our topology subscription logic should still
notify clients of all updates and so it makes more sense to have the
logic as part of the ChannelGraph so that we can send updates we receive
from the remote graph.
2025-03-24 15:05:48 +02:00
Elle Mouton
4131b3fc7e
graph/db: adjust TestPartialNode
The test as it stands today does not make sense as it adds a
Partial/Shell node to the graph via AddLightningNode which will never
happen since this is only ever triggered by the gossiper which only
calls the method with a full node announcement. Shell/Partial nodes are
only ever added via AddChannelEdge which will insert a partial node if
we are adding a channel edge which has node pub keys that we dont have a
node entry for. So we adjust the test to use this more accurate flow.
2025-03-24 15:05:48 +02:00
Elle Mouton
b497c4694e
multi: add Start and Stop methods for ChannelGraph
We do this in preparation for moving channel cache population logic out
of the constructor and into the Start method. We also will later on
(when topology subscription is moved to the ChannelGraph), have a
goroutine that will need to be kicked off and stopped.
2025-03-24 15:05:47 +02:00
Elle Mouton
bb3839e422
graph/db: completely remove cache from KVStore 2025-03-24 15:05:47 +02:00
Elle Mouton
4d00eb2aa4
graph/db: move FilterKnownChanIDs zombie logic up one layer
Here, we move the business logic in FilterKnownChanIDs from the CRUD
layer to the ChannelGraph layer. We also add a test for the logic.
2025-03-24 15:05:47 +02:00
Elle Mouton
9fe9e32c6e
graph/db: move cache read checks to ChannelGraph.
This commit moves the graph cache checks for FetchNodeFeatures,
ForEachNodeDirectedChannel, GraphSession and ForEachNodeCached from the
KVStore to the ChannelGraph. Since the ChannelGraph is currently just a
pass-through for any of the KVStore methods, all that needs to be done
for calls to go via the ChannelGraph instead directly to the KVStore is
for the ChannelGraph to go and implement those methods.
2025-03-24 15:05:46 +02:00
Elle Mouton
88398e3dd9
graph/db: let ChannelGraph init the graphCache
In this commit, we let the ChannelGraph be responsible for populating
the graphCache and then passing it to the KVStore. This is a first step
in moving the graphCache completely out of the KVStore layer.
2025-03-24 15:05:46 +02:00
Elle Mouton
00432e46f3
multi: add ChannelGraph Config struct
And use this struct to pass NewChannelGraph anything it needs to be able
to init the KVStore that it houses. This will allow us to add
ChannelGraph specific options.
2025-03-24 15:05:46 +02:00
Elle Mouton
f3805002ff
graph/db: unexport methods that take a transaction
Unexport and rename the methods that were previously used by the
graphsession package.
2025-02-18 10:15:55 -03:00
Elle Mouton
971832c792
graph: temporarily rename some ChannelGraph methods
Add the `Tx` suffix to both ForEachNodeDirectedChannelTx and
FetchNodeFeatures temporarily so that we free up the original names for
other use. The renamed methods will be removed or unexported in an
upcoming commit. The aim is to have no exported methods on the
ChannelGraph that accept a kvdb.RTx as a parameter.
2025-02-18 07:59:57 -03:00
Elle Mouton
5c2c00e414
graph/db: remove GraphCacheNode interface
With the previous commit, the AddNode method was removed and since that
was the only method making use of the ForEachChannel on the
GraphCacheNode interface, we can remove that method. Since the only two
methods left just expose the node's pub key and features, it really is
not required anymore and so the entire thing can be removed along with
the implementation of it.
2025-02-11 08:19:33 +02:00
Elle Mouton
9b86ee53db
graph+autopilot: let autopilot use new graph ForEachNode method
Which passes a NodeRTx to the call-back instead of a `kvdb.RTx`.
2025-02-10 09:46:15 +02:00
Elle Mouton
71b2338d53
graph/db: de(ser)ialise opaque node addrs
In this commit, we fix the bug demonstrated in the prior commit. We
correctly handle the persistence of lnwire.OpaqueAddrs.
2025-02-05 12:41:50 +02:00
Elle Mouton
d68d24d97e
graph/db: demonstrate LightningNode serialisation bug 2025-02-05 08:24:45 +02:00
Elle Mouton
ab7aae0708
multi: rename nolint:lll to nolint:ll
Find and replace all nolint instances refering to the `lll` linter and
replace with `ll` which is the name of our custom version of the `lll`
linter which can be used to ignore log lines during linting.

The next commit will do the configuration of the custom linter and
disable the default one.
2024-12-02 09:14:21 +02:00
Elle Mouton
4089fbcb44
multi: fix linter errors 2024-11-28 13:51:15 +02:00
Elle Mouton
6e13898981
multi: move LightningNode struct to models package 2024-11-28 13:36:32 +02:00
Elle Mouton
b86980ec40
channeldb: remove graph db from channeldb
Now that the channel.DB no longer uses the ChannelGraph pointer, we can
completely remove it as a member of channeldb.DB.
2024-11-28 13:36:15 +02:00
Elle Mouton
1859993734
channeldb+graphdb: init graph DB outside of channel db
We also now use the graph DB's own optional functions. An instance of
the graph is currently still passed to the channeldb's
`CreateWithBackend` function. This will be removed in a later commit
once the two have been completely disjoint.
2024-11-28 13:36:15 +02:00
Elle Mouton
74a4b1922b
refactor: move graph related DB code to graph/db from channeldb
This is a pure refactor commit. It moves over all the graph related CRUD
code from `channeldb` to `graph/db`.
2024-11-28 13:36:13 +02:00