routing: add source parameter to query routes

This commit allows execution of QueryRoutes from any source node.
Previously this was restricted to only the self node.
This commit is contained in:
Joost Jager committed 2019-03-06 15:31:03 +01:00
1 parent 7719bc432f
commit c62c9d64da
7 files changed
+646 -586

No files matched your search

+5 -5
View File
@@ -1325,9 +1325,9 @@ func pathsToFeeSortedRoutes(source Vertex, paths [][]*channeldb.ChannelEdgePolic
// the required fee and time lock values running backwards along the route. The
// route that will be ranked the highest is the one with the lowest cumulative
// fee along the route.
func (r *ChannelRouter) FindRoutes(target Vertex, amt lnwire.MilliSatoshi,
restrictions *RestrictParams, numPaths uint32, finalExpiry ...uint16) (
[]*Route, error) {
func (r *ChannelRouter) FindRoutes(source, target Vertex,
amt lnwire.MilliSatoshi, restrictions *RestrictParams, numPaths uint32,
finalExpiry ...uint16) ([]*Route, error) {
var finalCLTVDelta uint16
if len(finalExpiry) == 0 {
@@ -1394,8 +1394,8 @@ func (r *ChannelRouter) FindRoutes(target Vertex, amt lnwire.MilliSatoshi,
// we'll execute our KSP algorithm to find the k-shortest paths from
// our source to the destination.
shortestPaths, err := findPaths(
tx, r.cfg.Graph, r.selfNode.PubKeyBytes, target, amt,
restrictions, numPaths, bandwidthHints,
tx, r.cfg.Graph, source, target, amt, restrictions,
numPaths, bandwidthHints,
)
if err != nil {
tx.Rollback()