graph/db: version ForEachSourceNodeChannel
Add a gossip version parameter to ForEachSourceNodeChannel in the Store interface and both KV/SQL implementations. The VersionedGraph wrapper delegates with its baked-in version. Convert the testAddChannelEdgeShellNodes and testForEachSourceNodeChannel tests to run against both v1 and v2 gossip versions.
This commit is contained in:
6 files changed
+85
-59
No files matched your search
+8
-8
@@ -587,14 +587,6 @@ func (c *ChannelGraph) UpdateEdgePolicy(ctx context.Context,
|
||||
return nil
|
||||
}
|
||||
|
||||
// ForEachSourceNodeChannel iterates through all channels of the source node.
|
||||
func (c *ChannelGraph) ForEachSourceNodeChannel(ctx context.Context,
|
||||
cb func(chanPoint wire.OutPoint, havePolicy bool,
|
||||
otherNode *models.Node) error, reset func()) error {
|
||||
|
||||
return c.db.ForEachSourceNodeChannel(ctx, cb, reset)
|
||||
}
|
||||
|
||||
// ForEachNodeChannel iterates through all channels of the given node.
|
||||
func (c *ChannelGraph) ForEachNodeChannel(ctx context.Context,
|
||||
v lnwire.GossipVersion, nodePub route.Vertex,
|
||||
@@ -906,6 +898,14 @@ func (c *VersionedGraph) HasChannelEdge(chanID uint64) (bool, bool, error) {
|
||||
return c.db.HasChannelEdge(c.v, chanID)
|
||||
}
|
||||
|
||||
// ForEachSourceNodeChannel iterates through all channels of the source node.
|
||||
func (c *VersionedGraph) ForEachSourceNodeChannel(ctx context.Context,
|
||||
cb func(chanPoint wire.OutPoint, havePolicy bool,
|
||||
otherNode *models.Node) error, reset func()) error {
|
||||
|
||||
return c.db.ForEachSourceNodeChannel(ctx, c.v, cb, reset)
|
||||
}
|
||||
|
||||
// ForEachNodeChannel iterates through all channels of the given node.
|
||||
func (c *VersionedGraph) ForEachNodeChannel(ctx context.Context,
|
||||
nodePub route.Vertex, cb func(*models.ChannelEdgeInfo,
|
||||
|
||||
Reference in new issue
Block a user