cmd/lncli: expose the final_cltv_delta flag in sendpayment

This commit is contained in:
Olaoluwa Osuntokun 2018-01-19 17:32:32 -08:00
parent 0d75dde153
commit 84c8ed6362
No known key found for this signature in database
GPG Key ID: 964EA263DD637C21
1 changed files with 15 additions and 0 deletions

View File

@ -975,6 +975,10 @@ var sendPaymentCommand = cli.Command{
Name: "pay_req",
Usage: "a zpay32 encoded payment request to fulfill",
},
cli.Int64Flag{
Name: "final_cltv_delta",
Usage: "the number of blocks the last hop has to reveal the preimage",
},
},
Action: sendPayment,
}
@ -1055,6 +1059,17 @@ func sendPayment(ctx *cli.Context) error {
"bytes, is instead %v", len(rHash))
}
req.PaymentHash = rHash
switch {
case ctx.IsSet("final_cltv_delta"):
req.FinalCltvDelta = int32(ctx.Int64("final_cltv_delta"))
case args.Present():
delta, err := strconv.ParseInt(args.First(), 10, 64)
if err != nil {
return err
}
req.FinalCltvDelta = int32(delta)
}
}
}