-
Notifications
You must be signed in to change notification settings - Fork 2.2k
[g175] graph/db: v2 columns and v2 node CRUD #10339
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
Open
ellemouton
wants to merge
45
commits into
lightningnetwork:master
Choose a base branch
from
ellemouton:g175Prep3
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
Changes from 1 commit
Commits
Show all changes
45 commits
Select commit
Hold shift + click to select a range
3265d86
tools: use new golang 1.24 tool directive
ziggie1984 8dc48a9
tools: update golangci-lint to v2
ziggie1984 7b0b9b6
linter: remove unsupported linters from the codebase
ziggie1984 76d0250
CI: also use go tool for gosimports
ziggie1984 8f0a1dd
CI: remove unnecessary custom-gcl.yml file
ziggie1984 b977ba8
makefile: add linter config check
ziggie1984 80b98fd
lnwire: add NodeAnnouncement interface
ellemouton 750ac7c
lnwire: define GossipVersion and GossipMessage
ellemouton 5fc1e37
lnwire: let gossip messages implement GossipMessage
ellemouton e6e5f29
graph/db: use lnwire.GossipVersion instead of ProtocolVersion
ellemouton cbe5a5f
discovery: let reject cache use gossip version in key
ellemouton a0aad14
mulit: don't set customData on the lnrpc route level
ziggie1984 7f3a19c
paymentsdb: make verifyAttempt more robust
ziggie1984 b17a49f
lnwire: add onion message type
gijswijs 08d9685
lnrpc: SendOnionMessage rpc endpoint
gijswijs 6b16813
multi: endpoints for onion messages
gijswijs 2bcf09e
chore: thread context through to SendCustomMessage
gijswijs 6a1ea92
docs: update release notes for 0.21.0
gijswijs 490587d
models: simplify models.Node
ellemouton 7882b9b
multi: remove HaveNodeAnnouncement field from Node
ellemouton f2865f3
multi: add models.Node V1 constructor
ellemouton 255471c
graph/db: simplify auth proof and edge info
ellemouton 30e53b2
graph: remove DB interface
ellemouton 6fcdbbb
graph/db: remove outdated comment
ellemouton 1c3685f
graph/db: remove TestPopulateViaMigration
ellemouton 323c336
multi: freeze graph SQL migration logic
ellemouton dc134c0
go.mod: replace local sqldb
ellemouton 058e188
graph/db: freeze sql migration queries
ellemouton 2c9b47f
docs: update release notes
ellemouton 706b22a
Merge pull request #10338 from ellemouton/graphSQLMigFreeze
ellemouton 00690cc
devrpc: fix comment
ellemouton c149db4
sqldb: add new gossip v2 columns to graph tables
ellemouton d54c54d
graph/db: rename V1Store to Store
ellemouton f733f6c
graph/db: add V2 Node constructor
ellemouton ab2cd65
sqldb: update node query for v2
ellemouton 2cc17fd
graph/db: explicit redirect to Store
ellemouton 2115261
graph/db: allow v2 nodes
ellemouton d714da5
graph/db: split HasNode into two methods
ellemouton 1410779
graph/db: move gossip versions up one layer
ellemouton 4bc6f92
graph/db: add helper variable for tests
ellemouton f114ba0
graph/db: introduce VersionedReader
ellemouton bd8f180
graph/db: let node helpers take version
ellemouton 807a0ea
graph/db: test V2 node CRUD
ellemouton 46ce8ab
graph/db: convert other node CRUD methods
ellemouton 989e778
docs: update release notes
ellemouton File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or 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
This file contains hidden or 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
This file contains hidden or 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
This file contains hidden or 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
This file contains hidden or 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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -98,7 +98,7 @@ func TestNodeInsertionAndDeletion(t *testing.T) { | |
| t.Parallel() | ||
| ctx := t.Context() | ||
|
|
||
| graph := MakeTestGraph(t) | ||
| graph := NewVersionedReader(MakeTestGraph(t), lnwire.GossipVersion1) | ||
|
|
||
| // We'd like to test basic insertion/deletion for vertexes from the | ||
| // graph, so we'll create a test vertex to start with. | ||
|
|
@@ -123,7 +123,7 @@ func TestNodeInsertionAndDeletion(t *testing.T) { | |
| // without any errors. | ||
| node := nodeWithAddrs(testAddrs) | ||
| require.NoError(t, graph.AddNode(ctx, node)) | ||
| assertNodeInCache(t, graph, node, testFeatures) | ||
| assertNodeInCache(t, graph.ChannelGraph, node, testFeatures) | ||
|
|
||
| // Our AddNode implementation uses the batcher meaning that it is | ||
| // possible that two updates for the same node announcement may be | ||
|
|
@@ -153,7 +153,7 @@ func TestNodeInsertionAndDeletion(t *testing.T) { | |
|
|
||
| // Check that the node's features are fetched correctly. This check | ||
| // will check the database directly. | ||
| features, err = graph.db.FetchNodeFeatures( | ||
| features, err = graph.ChannelGraph.db.FetchNodeFeatures( | ||
|
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. this can also use |
||
| lnwire.GossipVersion1, node.PubKeyBytes, | ||
| ) | ||
| require.NoError(t, err) | ||
|
|
@@ -162,7 +162,7 @@ func TestNodeInsertionAndDeletion(t *testing.T) { | |
| // Next, delete the node from the graph, this should purge all data | ||
| // related to the node. | ||
| require.NoError(t, graph.DeleteNode(ctx, testPub)) | ||
| assertNodeNotInCache(t, graph, testPub) | ||
| assertNodeNotInCache(t, graph.ChannelGraph, testPub) | ||
|
|
||
| // Attempting to delete the node again should return an error since | ||
| // the node is no longer known. | ||
|
|
@@ -287,7 +287,7 @@ func TestPartialNode(t *testing.T) { | |
| t.Parallel() | ||
| ctx := t.Context() | ||
|
|
||
| graph := MakeTestGraph(t) | ||
| graph := NewVersionedReader(MakeTestGraph(t), lnwire.GossipVersion1) | ||
|
|
||
| // To insert a partial node, we need to add a channel edge that has | ||
| // node keys for nodes we are not yet aware | ||
|
|
@@ -301,8 +301,8 @@ func TestPartialNode(t *testing.T) { | |
|
|
||
| // Both of the nodes should now be in both the graph (as partial/shell) | ||
| // nodes _and_ the cache should also have an awareness of both nodes. | ||
| assertNodeInCache(t, graph, &node1, nil) | ||
| assertNodeInCache(t, graph, &node2, nil) | ||
| assertNodeInCache(t, graph.ChannelGraph, &node1, nil) | ||
| assertNodeInCache(t, graph.ChannelGraph, &node2, nil) | ||
|
|
||
| // Next, fetch the node2 from the database to ensure everything was | ||
| // serialized properly. | ||
|
|
@@ -332,7 +332,7 @@ func TestPartialNode(t *testing.T) { | |
| // Next, delete the node from the graph, this should purge all data | ||
| // related to the node. | ||
| require.NoError(t, graph.DeleteNode(ctx, pubKey1)) | ||
| assertNodeNotInCache(t, graph, testPub) | ||
| assertNodeNotInCache(t, graph.ChannelGraph, testPub) | ||
|
|
||
| // Finally, attempt to fetch the node again. This should fail as the | ||
| // node should have been deleted from the database. | ||
|
|
@@ -3691,7 +3691,7 @@ func TestPruneGraphNodes(t *testing.T) { | |
| t.Parallel() | ||
| ctx := t.Context() | ||
|
|
||
| graph := MakeTestGraph(t) | ||
| graph := NewVersionedReader(MakeTestGraph(t), lnwire.GossipVersion1) | ||
|
|
||
| // We'll start off by inserting our source node, to ensure that it's | ||
| // the only node left after we prune the graph. | ||
|
|
@@ -3742,7 +3742,7 @@ func TestPruneGraphNodes(t *testing.T) { | |
| // source node (which can't be pruned), and node 1+2. Nodes 1 and two | ||
| // should still be left in the graph as there's half of an advertised | ||
| // edge between them. | ||
| assertNumNodes(t, graph, 3) | ||
| assertNumNodes(t, graph.ChannelGraph, 3) | ||
|
|
||
| // Finally, we'll ensure that node3, the only fully unconnected node as | ||
| // properly deleted from the graph and not another node in its place. | ||
|
|
@@ -3757,7 +3757,7 @@ func TestAddChannelEdgeShellNodes(t *testing.T) { | |
| t.Parallel() | ||
| ctx := t.Context() | ||
|
|
||
| graph := MakeTestGraph(t) | ||
| graph := NewVersionedReader(MakeTestGraph(t), lnwire.GossipVersion1) | ||
|
|
||
| // To start, we'll create two nodes, and only add one of them to the | ||
| // channel graph. | ||
|
|
@@ -3796,7 +3796,7 @@ func TestNodePruningUpdateIndexDeletion(t *testing.T) { | |
| t.Parallel() | ||
| ctx := t.Context() | ||
|
|
||
| graph := MakeTestGraph(t) | ||
| graph := NewVersionedReader(MakeTestGraph(t), lnwire.GossipVersion1) | ||
|
|
||
| // We'll first populate our graph with a single node that will be | ||
| // removed shortly. | ||
|
|
@@ -3842,6 +3842,7 @@ func TestNodePruningUpdateIndexDeletion(t *testing.T) { | |
| var ( | ||
| updateTime = prand.Int63() | ||
| updateTimeMu sync.Mutex | ||
| updateBlock = prand.Uint32() | ||
| ) | ||
|
|
||
| func nextUpdateTime() time.Time { | ||
|
|
@@ -3853,6 +3854,15 @@ func nextUpdateTime() time.Time { | |
| return time.Unix(updateTime, 0) | ||
| } | ||
|
|
||
| func nextBlockHeight() uint32 { | ||
|
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. nit: used in the next commit |
||
| updateTimeMu.Lock() | ||
| defer updateTimeMu.Unlock() | ||
|
|
||
| updateBlock++ | ||
|
|
||
| return updateBlock | ||
| } | ||
|
|
||
| // TestNodeIsPublic ensures that we properly detect nodes that are seen as | ||
| // public within the network graph. | ||
| func TestNodeIsPublic(t *testing.T) { | ||
|
|
@@ -4755,7 +4765,7 @@ func TestLightningNodePersistence(t *testing.T) { | |
| ctx := t.Context() | ||
|
|
||
| // Create a new test graph instance. | ||
| graph := MakeTestGraph(t) | ||
| graph := NewVersionedReader(MakeTestGraph(t), lnwire.GossipVersion1) | ||
|
|
||
| nodeAnnBytes, err := hex.DecodeString(testNodeAnn) | ||
| require.NoError(t, err) | ||
|
|
||
This file contains hidden or 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
Oops, something went wrong.
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.
Uh oh!
There was an error while loading. Please reload this page.