From 982f53e6f2125f9716255fc764ed589d14b86a25 Mon Sep 17 00:00:00 2001 From: t4sk Date: Thu, 15 Feb 2018 19:27:05 +0700 Subject: [PATCH] rpc: modify QueryRoutes to take final_cltv_delta --- rpcserver.go | 18 ++++++++++++++---- 1 file changed, 14 insertions(+), 4 deletions(-) diff --git a/rpcserver.go b/rpcserver.go index 19263bfbd..b580c0be3 100644 --- a/rpcserver.go +++ b/rpcserver.go @@ -3087,11 +3087,21 @@ func (r *rpcServer) 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. - routes, err := r.server.chanRouter.FindRoutes( - pubKey, amtMSat, uint32(in.NumRoutes), + var ( + routes []*routing.Route + findErr error ) - if err != nil { - return nil, err + if in.FinalCltvDelta == 0 { + routes, findErr = r.server.chanRouter.FindRoutes( + pubKey, amtMSat, uint32(in.NumRoutes), + ) + } else { + routes, findErr = r.server.chanRouter.FindRoutes( + pubKey, amtMSat, uint32(in.NumRoutes), uint16(in.FinalCltvDelta), + ) + } + if findErr != nil { + return nil, findErr } // As the number of returned routes can be less than the number of