lnrpc+routing: add edges and nodes restrictions to query routes

This commit allows the execution of QueryRoutes to be controlled using
lists of black-listed edges and nodes. Any path returned will not pass
through the edges and/or nodes on the list.
This commit is contained in:
Joost Jager
2019-03-05 12:42:29 +01:00
parent 4376f3e1bd
commit b09adc3219
8 changed files with 757 additions and 595 deletions

View File

@@ -1326,7 +1326,7 @@ func pathsToFeeSortedRoutes(source Vertex, paths [][]*channeldb.ChannelEdgePolic
// route that will be ranked the highest is the one with the lowest cumulative
// fee along the route.
func (r *ChannelRouter) FindRoutes(target *btcec.PublicKey,
amt, feeLimit lnwire.MilliSatoshi, numPaths uint32,
amt lnwire.MilliSatoshi, restrictions *RestrictParams, numPaths uint32,
finalExpiry ...uint16) ([]*Route, error) {
var finalCLTVDelta uint16
@@ -1396,8 +1396,8 @@ func (r *ChannelRouter) FindRoutes(target *btcec.PublicKey,
// 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, target, amt, feeLimit, numPaths,
bandwidthHints,
tx, r.cfg.Graph, r.selfNode, target, amt, restrictions,
numPaths, bandwidthHints,
)
if err != nil {
tx.Rollback()