mirror of
https://github.com/lightningnetwork/lnd.git
synced 2025-09-28 23:12:32 +02:00
routerrpc+cmd: use skip_temp_err
when sending to route
This commit is contained in:
@@ -873,6 +873,13 @@ var sendToRouteCommand = cli.Command{
|
|||||||
Usage: "a json array string in the format of the response " +
|
Usage: "a json array string in the format of the response " +
|
||||||
"of queryroutes that denotes which routes to use",
|
"of queryroutes that denotes which routes to use",
|
||||||
},
|
},
|
||||||
|
cli.BoolFlag{
|
||||||
|
Name: "skip_temp_err",
|
||||||
|
Usage: "Whether the payment should be marked as " +
|
||||||
|
"failed when a temporary error occurred. Set " +
|
||||||
|
"it to true so the payment won't be failed " +
|
||||||
|
"unless a terminal error has occurred.",
|
||||||
|
},
|
||||||
},
|
},
|
||||||
Action: sendToRoute,
|
Action: sendToRoute,
|
||||||
}
|
}
|
||||||
@@ -966,6 +973,7 @@ func sendToRoute(ctx *cli.Context) error {
|
|||||||
req := &routerrpc.SendToRouteRequest{
|
req := &routerrpc.SendToRouteRequest{
|
||||||
PaymentHash: rHash,
|
PaymentHash: rHash,
|
||||||
Route: route,
|
Route: route,
|
||||||
|
SkipTempErr: ctx.Bool("skip_temp_err"),
|
||||||
}
|
}
|
||||||
|
|
||||||
return sendToRouteRequest(ctx, req)
|
return sendToRouteRequest(ctx, req)
|
||||||
|
@@ -399,13 +399,19 @@ func (s *Server) SendToRouteV2(ctx context.Context,
|
|||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
|
|
||||||
|
var attempt *channeldb.HTLCAttempt
|
||||||
|
|
||||||
// Pass route to the router. This call returns the full htlc attempt
|
// Pass route to the router. This call returns the full htlc attempt
|
||||||
// information as it is stored in the database. It is possible that both
|
// information as it is stored in the database. It is possible that both
|
||||||
// the attempt return value and err are non-nil. This can happen when
|
// the attempt return value and err are non-nil. This can happen when
|
||||||
// the attempt was already initiated before the error happened. In that
|
// the attempt was already initiated before the error happened. In that
|
||||||
// case, we give precedence to the attempt information as stored in the
|
// case, we give precedence to the attempt information as stored in the
|
||||||
// db.
|
// db.
|
||||||
attempt, err := s.cfg.Router.SendToRoute(hash, route)
|
if req.SkipTempErr {
|
||||||
|
attempt, err = s.cfg.Router.SendToRouteSkipTempErr(hash, route)
|
||||||
|
} else {
|
||||||
|
attempt, err = s.cfg.Router.SendToRoute(hash, route)
|
||||||
|
}
|
||||||
if attempt != nil {
|
if attempt != nil {
|
||||||
rpcAttempt, err := s.cfg.RouterBackend.MarshalHTLCAttempt(
|
rpcAttempt, err := s.cfg.RouterBackend.MarshalHTLCAttempt(
|
||||||
*attempt,
|
*attempt,
|
||||||
|
Reference in New Issue
Block a user