cmd/lncli: accept zpay32 requests in sendpayment command
This commit is contained in:
parent
5a9be3f812
commit
9b50df704c
@ -546,10 +546,9 @@ var SendPaymentCommand = cli.Command{
|
|||||||
Name: "debug_send",
|
Name: "debug_send",
|
||||||
Usage: "use the debug rHash when sending the HTLC",
|
Usage: "use the debug rHash when sending the HTLC",
|
||||||
},
|
},
|
||||||
cli.BoolFlag{
|
cli.StringFlag{
|
||||||
Name: "fast, f",
|
Name: "pay_req",
|
||||||
Usage: "skip the HTLC trickle logic, immediately creating a " +
|
Usage: "a zbase32-check encoded payment request to fulfill",
|
||||||
"new commitment",
|
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
Action: sendPaymentCommand,
|
Action: sendPaymentCommand,
|
||||||
@ -558,6 +557,12 @@ var SendPaymentCommand = cli.Command{
|
|||||||
func sendPaymentCommand(ctx *cli.Context) error {
|
func sendPaymentCommand(ctx *cli.Context) error {
|
||||||
client := getClient(ctx)
|
client := getClient(ctx)
|
||||||
|
|
||||||
|
var req *lnrpc.SendRequest
|
||||||
|
if ctx.String("pay_req") != "" {
|
||||||
|
req = &lnrpc.SendRequest{
|
||||||
|
PaymentRequest: ctx.String("pay_req"),
|
||||||
|
}
|
||||||
|
} else {
|
||||||
destNode, err := hex.DecodeString(ctx.String("dest"))
|
destNode, err := hex.DecodeString(ctx.String("dest"))
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
@ -567,10 +572,9 @@ func sendPaymentCommand(ctx *cli.Context) error {
|
|||||||
"instead: %v", len(destNode))
|
"instead: %v", len(destNode))
|
||||||
}
|
}
|
||||||
|
|
||||||
req := &lnrpc.SendRequest{
|
req = &lnrpc.SendRequest{
|
||||||
Dest: destNode,
|
Dest: destNode,
|
||||||
Amt: int64(ctx.Int("amt")),
|
Amt: int64(ctx.Int("amt")),
|
||||||
FastSend: ctx.Bool("fast"),
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if !ctx.Bool("debug_send") {
|
if !ctx.Bool("debug_send") {
|
||||||
@ -584,6 +588,7 @@ func sendPaymentCommand(ctx *cli.Context) error {
|
|||||||
}
|
}
|
||||||
req.PaymentHash = rHash
|
req.PaymentHash = rHash
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
paymentStream, err := client.SendPayment(context.Background())
|
paymentStream, err := client.SendPayment(context.Background())
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
Loading…
Reference in New Issue
Block a user