mirror of
https://github.com/lightningnetwork/lnd.git
synced 2025-03-18 13:52:02 +01:00
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.
This commit is contained in:
parent
971832c792
commit
5d5cfe36c7
@ -80,10 +80,11 @@ func (g *session) close() error {
|
||||
return nil
|
||||
}
|
||||
|
||||
// ForEachNodeChannel calls the callback for every channel of the given node.
|
||||
// ForEachNodeDirectedChannel calls the callback for every channel of the given
|
||||
// node.
|
||||
//
|
||||
// NOTE: Part of the routing.Graph interface.
|
||||
func (g *session) ForEachNodeChannel(nodePub route.Vertex,
|
||||
func (g *session) ForEachNodeDirectedChannel(nodePub route.Vertex,
|
||||
cb func(channel *graphdb.DirectedChannel) error) error {
|
||||
|
||||
return g.graph.ForEachNodeDirectedChannelTx(g.tx, nodePub, cb)
|
||||
|
@ -63,7 +63,7 @@ func newBandwidthManager(graph Graph, sourceNode route.Vertex,
|
||||
|
||||
// First, we'll collect the set of outbound edges from the target
|
||||
// source node and add them to our bandwidth manager's map of channels.
|
||||
err := graph.ForEachNodeChannel(sourceNode,
|
||||
err := graph.ForEachNodeDirectedChannel(sourceNode,
|
||||
func(channel *graphdb.DirectedChannel) error {
|
||||
shortID := lnwire.NewShortChanIDFromInt(
|
||||
channel.ChannelID,
|
||||
|
@ -12,9 +12,9 @@ import (
|
||||
// Graph is an abstract interface that provides information about nodes and
|
||||
// edges to pathfinding.
|
||||
type Graph interface {
|
||||
// ForEachNodeChannel calls the callback for every channel of the given
|
||||
// node.
|
||||
ForEachNodeChannel(nodePub route.Vertex,
|
||||
// ForEachNodeDirectedChannel calls the callback for every channel of
|
||||
// the given node.
|
||||
ForEachNodeDirectedChannel(nodePub route.Vertex,
|
||||
cb func(channel *graphdb.DirectedChannel) error) error
|
||||
|
||||
// FetchNodeFeatures returns the features of the given node.
|
||||
|
@ -391,7 +391,7 @@ func (g *mockGraphSessionChanDB) close() error {
|
||||
return nil
|
||||
}
|
||||
|
||||
func (g *mockGraphSessionChanDB) ForEachNodeChannel(nodePub route.Vertex,
|
||||
func (g *mockGraphSessionChanDB) ForEachNodeDirectedChannel(nodePub route.Vertex,
|
||||
cb func(channel *graphdb.DirectedChannel) error) error {
|
||||
|
||||
return g.graph.ForEachNodeDirectedChannelTx(g.tx, nodePub, cb)
|
||||
|
@ -165,7 +165,7 @@ func (m *mockGraph) addChannel(id uint64, node1id, node2id byte,
|
||||
// forEachNodeChannel calls the callback for every channel of the given node.
|
||||
//
|
||||
// NOTE: Part of the Graph interface.
|
||||
func (m *mockGraph) ForEachNodeChannel(nodePub route.Vertex,
|
||||
func (m *mockGraph) ForEachNodeDirectedChannel(nodePub route.Vertex,
|
||||
cb func(channel *graphdb.DirectedChannel) error) error {
|
||||
|
||||
// Look up the mock node.
|
||||
|
@ -557,7 +557,7 @@ func getOutgoingBalance(node route.Vertex, outgoingChans map[uint64]struct{},
|
||||
}
|
||||
|
||||
// Iterate over all channels of the to node.
|
||||
err := g.ForEachNodeChannel(node, cb)
|
||||
err := g.ForEachNodeDirectedChannel(node, cb)
|
||||
if err != nil {
|
||||
return 0, 0, err
|
||||
}
|
||||
@ -1325,7 +1325,7 @@ func processNodeForBlindedPath(g Graph, node route.Vertex,
|
||||
|
||||
// Now, iterate over the node's channels in search for paths to this
|
||||
// node that can be used for blinded paths
|
||||
err = g.ForEachNodeChannel(node,
|
||||
err = g.ForEachNodeDirectedChannel(node,
|
||||
func(channel *graphdb.DirectedChannel) error {
|
||||
// Keep track of how many incoming channels this node
|
||||
// has. We only use a node as an introduction node if it
|
||||
|
@ -125,7 +125,7 @@ func (u *nodeEdgeUnifier) addGraphPolicies(g Graph) error {
|
||||
}
|
||||
|
||||
// Iterate over all channels of the to node.
|
||||
return g.ForEachNodeChannel(u.toNode, cb)
|
||||
return g.ForEachNodeDirectedChannel(u.toNode, cb)
|
||||
}
|
||||
|
||||
// unifiedEdge is the individual channel data that is kept inside an edgeUnifier
|
||||
|
Loading…
x
Reference in New Issue
Block a user