mirror of
https://github.com/lightningnetwork/lnd.git
synced 2025-08-30 23:53:41 +02:00
routing+channeldb: findPath uses Vertex instead of LightningNode
This commit modifies the nodeWithDist struct to use a route.Vertex instead of a *channeldb.LightningNode. This change, coupled with the new ForEachNodeChannel function, allows the findPath Djikstra's algorithm to cut down on database lookups since we no longer need to call the FetchOtherNode function.
This commit is contained in:
@@ -3,6 +3,7 @@ package routing
|
||||
import (
|
||||
"github.com/lightningnetwork/lnd/channeldb"
|
||||
"github.com/lightningnetwork/lnd/lnwire"
|
||||
"github.com/lightningnetwork/lnd/routing/route"
|
||||
)
|
||||
|
||||
// nodeWithDist is a helper struct that couples the distance from the current
|
||||
@@ -12,9 +13,9 @@ type nodeWithDist struct {
|
||||
// current context.
|
||||
dist int64
|
||||
|
||||
// node is the vertex itself. This pointer can be used to explore all
|
||||
// the outgoing edges (channels) emanating from a node.
|
||||
node *channeldb.LightningNode
|
||||
// node is the vertex itself. This can be used to explore all the
|
||||
// outgoing edges (channels) emanating from a node.
|
||||
node route.Vertex
|
||||
|
||||
// amountToReceive is the amount that should be received by this node.
|
||||
// Either as final payment to the final node or as an intermediate
|
||||
|
Reference in New Issue
Block a user