lncli: add show_inflight flag

This commit is contained in:
Joost Jager 2020-04-06 12:46:05 +02:00
parent af4abe7d58
commit 3ed3c90efe
No known key found for this signature in database
GPG Key ID: A61B9D4C393C59C7

@ -46,6 +46,12 @@ var (
"<hex_value>,.. For example: --data 3438382=0a21ff. " + "<hex_value>,.. For example: --data 3438382=0a21ff. " +
"Custom record ids start from 65536.", "Custom record ids start from 65536.",
} }
showInflightFlag = cli.BoolFlag{
Name: "show_inflight",
Usage: "if set, intermediate payment state updates will be " +
"displayed",
}
) )
// paymentFlags returns common flags for sendpayment and payinvoice. // paymentFlags returns common flags for sendpayment and payinvoice.
@ -82,7 +88,7 @@ func paymentFlags() []cli.Flag {
Name: "allow_self_payment", Name: "allow_self_payment",
Usage: "allow sending a circular payment to self", Usage: "allow sending a circular payment to self",
}, },
dataFlag, dataFlag, showInflightFlag,
} }
} }
@ -382,6 +388,8 @@ func sendPaymentRequest(ctx *cli.Context,
req.FeeLimitSat = feeLimit req.FeeLimitSat = feeLimit
showInflight := ctx.Bool(showInflightFlag.Name)
stream, err := routerClient.SendPayment(context.Background(), req) stream, err := routerClient.SendPayment(context.Background(), req)
if err != nil { if err != nil {
return err return err
@ -405,6 +413,10 @@ func sendPaymentRequest(ctx *cli.Context,
return nil return nil
} }
if showInflight {
printRespJSON(status)
}
} }
} }