graph/db: split HasNode into two methods
HasNode currently is very v1 specific since it returns a time.Time timestamp which is specific to V1 node announcements. However, it is mostly only used for the "exists" return value. So here we split it up into HasNode which just checks existence and HasV1Node which retains the same behavaiour as before.
This commit is contained in:
8 files changed
+100
-25
No files matched your search
+11
-2
@@ -664,10 +664,19 @@ func (c *ChannelGraph) FetchNode(ctx context.Context,
|
||||
return c.db.FetchNode(ctx, nodePub)
|
||||
}
|
||||
|
||||
// HasNode determines if the graph has a vertex identified by the target node.
|
||||
func (c *ChannelGraph) HasNode(ctx context.Context,
|
||||
// HasV1Node determines if the graph has a vertex identified by the target node
|
||||
// in the V1 graph.
|
||||
func (c *ChannelGraph) HasV1Node(ctx context.Context,
|
||||
nodePub [33]byte) (time.Time, bool, error) {
|
||||
|
||||
return c.db.HasV1Node(ctx, nodePub)
|
||||
}
|
||||
|
||||
// HasNode determines if the graph has a vertex identified by the target node
|
||||
// in the V1 graph.
|
||||
func (c *ChannelGraph) HasNode(ctx context.Context, nodePub [33]byte) (bool,
|
||||
error) {
|
||||
|
||||
return c.db.HasNode(ctx, nodePub)
|
||||
}
|
||||
|
||||
|
||||
Reference in new issue
Block a user