router: return probability from findPath

The returned probability can then be used in QueryRoutes to not having
to reconstruct the probability.
This commit is contained in:
bitromortac committed 2022-12-12 13:22:29 +01:00
1 parent 516e3a8cca
commit 66ffc64776
9 files changed
+47 -45

No files matched your search

+2 -2
View File
@@ -57,7 +57,7 @@ type RouterBackend struct {
restrictions *routing.RestrictParams,
destCustomRecords record.CustomSet,
routeHints map[route.Vertex][]*channeldb.CachedEdgePolicy,
finalExpiry uint16) (*route.Route, error)
finalExpiry uint16) (*route.Route, float64, error)
MissionControl MissionControl
@@ -325,7 +325,7 @@ func (r *RouterBackend) QueryRoutes(ctx context.Context,
// Query the channel router for a possible path to the destination that
// can carry `in.Amt` satoshis _including_ the total fee required on
// the route.
route, err := r.FindRoute(
route, _, err := r.FindRoute(
sourcePubKey, targetPubKey, amt, in.TimePref, restrictions,
customRecords, routeHintEdges, finalCLTVDelta,
)
+4 -2
View File
@@ -126,7 +126,7 @@ func testQueryRoutes(t *testing.T, useMissionControl bool, useMsat bool,
amt lnwire.MilliSatoshi, _ float64,
restrictions *routing.RestrictParams, _ record.CustomSet,
routeHints map[route.Vertex][]*channeldb.CachedEdgePolicy,
finalExpiry uint16) (*route.Route, error) {
finalExpiry uint16) (*route.Route, float64, error) {
if int64(amt) != amtSat*1000 {
t.Fatal("unexpected amount")
@@ -187,7 +187,9 @@ func testQueryRoutes(t *testing.T, useMissionControl bool, useMsat bool,
}
hops := []*route.Hop{{}}
return route.NewRouteFromHops(amt, 144, source, hops)
route, err := route.NewRouteFromHops(amt, 144, source, hops)
return route, expectedProb, err
}
backend := &RouterBackend{
+1 -1
View File
@@ -366,7 +366,7 @@ func (s *Server) EstimateRouteFee(ctx context.Context,
// restriction for the default CLTV limit, otherwise we can find a route
// that exceeds it and is useless to us.
mc := s.cfg.RouterBackend.MissionControl
route, err := s.cfg.Router.FindRoute(
route, _, err := s.cfg.Router.FindRoute(
s.cfg.RouterBackend.SelfNode, destNode, amtMsat, 0,
&routing.RestrictParams{
FeeLimit: feeLimit,