forked from lightningnetwork/lnd
-
Notifications
You must be signed in to change notification settings - Fork 0
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Mega graph clean #171
Open
ellemouton
wants to merge
29
commits into
master
Choose a base branch
from
megaGraphClean
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Mega graph clean #171
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Simplify the ChannelGraphSource interface by removing this unused method.
For consistency in the graphsessoin.graph interface, we let the FetchNodeFeatures method take a read transaction just like the ForEachNodeDirectedChannel. This is nice because then all calls in the same pathfinding transaction use the same read transaction.
The package name is kept the same. So this is just for less stuttering at a path level.
This commit adds a new GraphSources interface that LND requires for graph related read-only queries. As of this commit, the interface is empty but it will be populated over the next couple of commits. We add an implementation of this interface backed by a pointer to a graphdb.ChannelGraph. The infrustructure is put into place so that the GraphSoure provided to LND can be overridden by a caller of the lnd.Main function. By default, LND will satisfy the interface itself via the new `graphsource.DBSource` struct.
In this commit, we take the existing graphsession.ReadyOnlyGraph interface and remove its usage of a kvdb.RTx and replace it with a more abstract `RTx` interface type. The new GraphSource interface is expanded to include the graphsession.ReadOnlyGraph interface and the implementation of it, DBSource, is expanded to include the new methods. It converts the given RTx to the underlying kvdb read transaction where needed.
Since the GraphSource interface may be satisfied by an RPC connection, it is best practice to pass a context through to any call in the interface. The ChanGraphSource implementation, which uses a kvdb backend, does not make use of the ctx. Any call-sites are for now given a `context.TODO()` which will all be addressed in follow up commits.
Define a new GraphSource interface required by the invoicerpc server and remove its access to the graphdb.ChannelGraph pointer. Add the new invoicesrpc.GraphSource interface to the GraphSource interface and let DBSource implement it.
And let DBSource implement it.
In this commit, we add a bunch of graph methods to the GraphSource, let DBSource implement it and then we use the graph source for these methods for the GetNodeInfo, VerifyMessage, DescribeGraph, GetNodeMetrics, GetChanInfo and GetNodeInfo RPC calls along with peer alias lookup.
We will later implement this interface with a backing RPC connection and so it makes sense to pass a context through for cancellation.
So that LND can use a different GraphSource for network bootstrapping and does not need to rely on its local graph db.
so that the external graph source can be used to query network information rather than depending on the local graph DB.
So that the calcuation is abstracted behind the interface and not necessarily dependent on LND's local channel graph.
Remove four context.TODO()s
Pull reviewers statsStats of the last 30 days for lnd:
|
Pull Request Test Coverage Report for Build 12690012727Details
💛 - Coveralls |
ellemouton
force-pushed
the
megaGraphClean
branch
from
January 9, 2025 12:36
ed78d2c
to
f032a3e
Compare
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Change Description
Description of change / link to associated issue.
Steps to Test
Steps for reviewers to follow to test the change.
Pull Request Checklist
Testing
Code Style and Documentation
[skip ci]
in the commit message for small changes.📝 Please see our Contribution Guidelines for further guidance.