lncli: optionally include the amount in the payment request

This commit is contained in:
Wilmer Paulino 2018-01-22 15:28:50 -05:00
parent f0d6d31ca4
commit 454eab720e
No known key found for this signature in database
GPG Key ID: 6DF57B9F9514972F

@ -1014,6 +1014,7 @@ func sendPayment(ctx *cli.Context) error {
if ctx.IsSet("pay_req") { if ctx.IsSet("pay_req") {
req = &lnrpc.SendRequest{ req = &lnrpc.SendRequest{
PaymentRequest: ctx.String("pay_req"), PaymentRequest: ctx.String("pay_req"),
Amt: ctx.Int64("amt"),
} }
} else { } else {
args := ctx.Args() args := ctx.Args()
@ -1138,6 +1139,11 @@ var payInvoiceCommand = cli.Command{
Name: "pay_req", Name: "pay_req",
Usage: "a zpay32 encoded payment request to fulfill", Usage: "a zpay32 encoded payment request to fulfill",
}, },
cli.Int64Flag{
Name: "amt",
Usage: "(optional) number of satoshis to fulfill the " +
"invoice",
},
}, },
Action: actionDecorator(payInvoice), Action: actionDecorator(payInvoice),
} }
@ -1158,6 +1164,7 @@ func payInvoice(ctx *cli.Context) error {
req := &lnrpc.SendRequest{ req := &lnrpc.SendRequest{
PaymentRequest: payReq, PaymentRequest: payReq,
Amt: ctx.Int64("amt"),
} }
return sendPaymentRequest(ctx, req) return sendPaymentRequest(ctx, req)