Skip to content

Commit 5d5cfe3

Browse files
committed
routing: rename routing Graph method
In preparation for having the ChannelGraph directly implement the `routing.Graph` interface, we rename the `ForEachNodeChannel` method to `ForEachNodeDirectedChannel` since the ChannelGraph already uses the `ForEachNodeChannel` name and the new name is more appropriate since the ChannelGraph currently has a `ForEachNodeDirectedChannelTx` method which passes the same DirectedChannel type to the given call-back.
1 parent 971832c commit 5d5cfe3

File tree

7 files changed

+12
-11
lines changed

7 files changed

+12
-11
lines changed

graph/graphsession/graph_session.go

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -80,10 +80,11 @@ func (g *session) close() error {
8080
return nil
8181
}
8282

83-
// ForEachNodeChannel calls the callback for every channel of the given node.
83+
// ForEachNodeDirectedChannel calls the callback for every channel of the given
84+
// node.
8485
//
8586
// NOTE: Part of the routing.Graph interface.
86-
func (g *session) ForEachNodeChannel(nodePub route.Vertex,
87+
func (g *session) ForEachNodeDirectedChannel(nodePub route.Vertex,
8788
cb func(channel *graphdb.DirectedChannel) error) error {
8889

8990
return g.graph.ForEachNodeDirectedChannelTx(g.tx, nodePub, cb)

routing/bandwidth.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,7 @@ func newBandwidthManager(graph Graph, sourceNode route.Vertex,
6363

6464
// First, we'll collect the set of outbound edges from the target
6565
// source node and add them to our bandwidth manager's map of channels.
66-
err := graph.ForEachNodeChannel(sourceNode,
66+
err := graph.ForEachNodeDirectedChannel(sourceNode,
6767
func(channel *graphdb.DirectedChannel) error {
6868
shortID := lnwire.NewShortChanIDFromInt(
6969
channel.ChannelID,

routing/graph.go

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -12,9 +12,9 @@ import (
1212
// Graph is an abstract interface that provides information about nodes and
1313
// edges to pathfinding.
1414
type Graph interface {
15-
// ForEachNodeChannel calls the callback for every channel of the given
16-
// node.
17-
ForEachNodeChannel(nodePub route.Vertex,
15+
// ForEachNodeDirectedChannel calls the callback for every channel of
16+
// the given node.
17+
ForEachNodeDirectedChannel(nodePub route.Vertex,
1818
cb func(channel *graphdb.DirectedChannel) error) error
1919

2020
// FetchNodeFeatures returns the features of the given node.

routing/integrated_routing_context_test.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -391,7 +391,7 @@ func (g *mockGraphSessionChanDB) close() error {
391391
return nil
392392
}
393393

394-
func (g *mockGraphSessionChanDB) ForEachNodeChannel(nodePub route.Vertex,
394+
func (g *mockGraphSessionChanDB) ForEachNodeDirectedChannel(nodePub route.Vertex,
395395
cb func(channel *graphdb.DirectedChannel) error) error {
396396

397397
return g.graph.ForEachNodeDirectedChannelTx(g.tx, nodePub, cb)

routing/mock_graph_test.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -165,7 +165,7 @@ func (m *mockGraph) addChannel(id uint64, node1id, node2id byte,
165165
// forEachNodeChannel calls the callback for every channel of the given node.
166166
//
167167
// NOTE: Part of the Graph interface.
168-
func (m *mockGraph) ForEachNodeChannel(nodePub route.Vertex,
168+
func (m *mockGraph) ForEachNodeDirectedChannel(nodePub route.Vertex,
169169
cb func(channel *graphdb.DirectedChannel) error) error {
170170

171171
// Look up the mock node.

routing/pathfind.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -557,7 +557,7 @@ func getOutgoingBalance(node route.Vertex, outgoingChans map[uint64]struct{},
557557
}
558558

559559
// Iterate over all channels of the to node.
560-
err := g.ForEachNodeChannel(node, cb)
560+
err := g.ForEachNodeDirectedChannel(node, cb)
561561
if err != nil {
562562
return 0, 0, err
563563
}
@@ -1325,7 +1325,7 @@ func processNodeForBlindedPath(g Graph, node route.Vertex,
13251325

13261326
// Now, iterate over the node's channels in search for paths to this
13271327
// node that can be used for blinded paths
1328-
err = g.ForEachNodeChannel(node,
1328+
err = g.ForEachNodeDirectedChannel(node,
13291329
func(channel *graphdb.DirectedChannel) error {
13301330
// Keep track of how many incoming channels this node
13311331
// has. We only use a node as an introduction node if it

routing/unified_edges.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -125,7 +125,7 @@ func (u *nodeEdgeUnifier) addGraphPolicies(g Graph) error {
125125
}
126126

127127
// Iterate over all channels of the to node.
128-
return g.ForEachNodeChannel(u.toNode, cb)
128+
return g.ForEachNodeDirectedChannel(u.toNode, cb)
129129
}
130130

131131
// unifiedEdge is the individual channel data that is kept inside an edgeUnifier

0 commit comments

Comments
 (0)