routerrpc+lncli: add flag to suppress in-flight updates

This is a preparation for enabling the REST interface on routerrpc.
It provides REST clients that don't support server-side streaming
via keep-alive connections to use the streaming endpoint in the
typical request/response pattern. The url just needs to contain
?no_inflight_updates=true and only the terminal response is sent
back before the connection is closed.
This commit is contained in:
Joost Jager authored and Olaoluwa Osuntokun committed 2020-04-21 17:02:09 -07:00
1 parent 1e51ec0a2d
commit d51bb65536
4 files changed
+191 -151

No files matched your search

+3 -7
View File
@@ -397,7 +397,7 @@ func sendPaymentRequest(ctx *cli.Context,
req.FeeLimitSat = feeLimit
showInflight := ctx.Bool(showInflightFlag.Name)
req.NoInflightUpdates = !ctx.Bool(showInflightFlag.Name)
stream, err := routerClient.SendPaymentV2(context.Background(), req)
if err != nil {
@@ -410,9 +410,9 @@ func sendPaymentRequest(ctx *cli.Context,
return err
}
if status.Status != lnrpc.Payment_IN_FLIGHT {
printRespJSON(status)
printRespJSON(status)
if status.Status != lnrpc.Payment_IN_FLIGHT {
// If we get a payment error back, we pass an error up
// to main which eventually calls fatal() and returns
// with a non-zero exit code.
@@ -422,10 +422,6 @@ func sendPaymentRequest(ctx *cli.Context,
return nil
}
if showInflight {
printRespJSON(status)
}
}
}