routing: backward searching

This commit is contained in:
Joost Jager
2018-06-04 22:10:05 +02:00
committed by Olaoluwa Osuntokun
parent e52d829168
commit 3e7473f4f0
7 changed files with 295 additions and 152 deletions

View File

@ -1,6 +1,9 @@
package routing
import "github.com/lightningnetwork/lnd/channeldb"
import (
"github.com/lightningnetwork/lnd/channeldb"
"github.com/lightningnetwork/lnd/lnwire"
)
// nodeWithDist is a helper struct that couples the distance from the current
// source to a node with a pointer to the node itself.
@ -12,6 +15,14 @@ type nodeWithDist struct {
// node is the vertex itself. This pointer can be used to explore all
// the outgoing edges (channels) emanating from a node.
node *channeldb.LightningNode
// amountToReceive is the amount that should be received by this node.
// Either as final payment to the final node or as an intermediate
// amount that includes also the fees for subsequent hops.
amountToReceive lnwire.MilliSatoshi
// fee is the fee that this node is charging for forwarding.
fee lnwire.MilliSatoshi
}
// distanceHeap is a min-distance heap that's used within our path finding