graph/db: convert other node CRUD methods

Convert a few more CRUD methods to handle v2 nodes. Then update some
more tests to be run against both v1 and v2 nodes.
This commit is contained in:
Elle Mouton committed 2026-02-13 07:21:21 +02:00
1 parent 7a5a588176
commit 7bb38651d9
7 files changed
+82 -63

No files matched your search

+14 -12
View File
@@ -618,13 +618,6 @@ func (c *ChannelGraph) ForEachNodeCacheable(ctx context.Context,
return c.db.ForEachNodeCacheable(ctx, cb, reset)
}
// LookupAlias attempts to return the alias as advertised by the target node.
func (c *ChannelGraph) LookupAlias(ctx context.Context,
pub *btcec.PublicKey) (string, error) {
return c.db.LookupAlias(ctx, lnwire.GossipVersion1, pub)
}
// NodeUpdatesInHorizon returns all known lightning nodes with updates in the
// range.
func (c *ChannelGraph) NodeUpdatesInHorizon(startTime, endTime time.Time,
@@ -755,11 +748,6 @@ func (c *ChannelGraph) IsClosedScid(scid lnwire.ShortChannelID) (bool, error) {
return c.db.IsClosedScid(scid)
}
// SourceNode returns the source node of the graph.
func (c *ChannelGraph) SourceNode(ctx context.Context) (*models.Node, error) {
return c.db.SourceNode(ctx, lnwire.GossipVersion1)
}
// SetSourceNode sets the source node within the graph database.
func (c *ChannelGraph) SetSourceNode(ctx context.Context,
node *models.Node) error {
@@ -828,6 +816,20 @@ func (c *VersionedGraph) HasNode(ctx context.Context, nodePub [33]byte) (bool,
return c.db.HasNode(ctx, c.v, nodePub)
}
// LookupAlias attempts to return the alias as advertised by the target node.
func (c *VersionedGraph) LookupAlias(ctx context.Context,
pub *btcec.PublicKey) (string, error) {
return c.db.LookupAlias(ctx, c.v, pub)
}
// SourceNode returns the source node of the graph.
func (c *VersionedGraph) SourceNode(ctx context.Context) (*models.Node,
error) {
return c.db.SourceNode(ctx, c.v)
}
// MakeTestGraph creates a new instance of the ChannelGraph for testing
// purposes. The backing Store implementation depends on the version of
// NewTestDB included in the current build.