mirror of
https://github.com/lightningnetwork/lnd.git
synced 2025-09-26 09:26:20 +02:00
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:
committed by
Olaoluwa Osuntokun
parent
11a007dc16
commit
48e36d93d4
@@ -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),
|
||||
|
Reference in New Issue
Block a user