multi/refactor: add RouteRequest to hold FindRoute parameters

This commit introduces a single struct to hold all of the parameters
that are passed to FindRoute. This cleans up an already overloaded
function signature and prepares us for handling requests with blinded
routes where we need to perform some additional processing on our
para (such as extracting the target node from the blinded path).
This commit is contained in:
Carla Kirk-Cohen
2022-12-19 17:10:22 -05:00
committed by Olaoluwa Osuntokun
parent 11a007dc16
commit 48e36d93d4
6 changed files with 127 additions and 54 deletions

View File

@@ -398,8 +398,8 @@ 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(
s.cfg.RouterBackend.SelfNode, destNode, amtMsat, 0,
routeReq, err := routing.NewRouteRequest(
s.cfg.RouterBackend.SelfNode, &destNode, amtMsat, 0,
&routing.RestrictParams{
FeeLimit: feeLimit,
CltvLimit: s.cfg.RouterBackend.MaxTotalTimelock,
@@ -410,6 +410,11 @@ func (s *Server) EstimateRouteFee(ctx context.Context,
return nil, err
}
route, _, err := s.cfg.Router.FindRoute(routeReq)
if err != nil {
return nil, err
}
return &RouteFeeResponse{
RoutingFeeMsat: int64(route.TotalFees()),
TimeLockDelay: int64(route.TotalTimeLock),