mirror of
https://github.com/lightningnetwork/lnd.git
synced 2024-11-19 09:53:54 +01:00
rpc: modify QueryRoutes to take final_cltv_delta
This commit is contained in:
parent
d6ca581cbc
commit
982f53e6f2
18
rpcserver.go
18
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
|
// Query the channel router for a possible path to the destination that
|
||||||
// can carry `in.Amt` satoshis _including_ the total fee required on
|
// can carry `in.Amt` satoshis _including_ the total fee required on
|
||||||
// the route.
|
// the route.
|
||||||
routes, err := r.server.chanRouter.FindRoutes(
|
var (
|
||||||
pubKey, amtMSat, uint32(in.NumRoutes),
|
routes []*routing.Route
|
||||||
|
findErr error
|
||||||
)
|
)
|
||||||
if err != nil {
|
if in.FinalCltvDelta == 0 {
|
||||||
return nil, err
|
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
|
// As the number of returned routes can be less than the number of
|
||||||
|
Loading…
Reference in New Issue
Block a user