Skip to content

Commit

Permalink
lncli: cancelable flag for SendPaymentRequest
Browse files Browse the repository at this point in the history
  • Loading branch information
hieblmi committed May 16, 2024
1 parent 96316d6 commit 9a3fa63
Showing 1 changed file with 11 additions and 0 deletions.
11 changes: 11 additions & 0 deletions cmd/lncli/cmd_payments.go
Original file line number Diff line number Diff line change
Expand Up @@ -139,6 +139,13 @@ var (
Usage: "(blinded paths) the total cltv delay for the " +
"blinded portion of the route",
}

cancelableFlag = cli.BoolFlag{
Name: "cancelable",
Usage: "if set to true, the current payment attempt " +
"can be canceled in the backend by " +
"terminating the payment request",
}
)

// paymentFlags returns common flags for sendpayment and payinvoice.
Expand Down Expand Up @@ -166,6 +173,7 @@ func paymentFlags() []cli.Flag {
"after the timeout has elapsed",
Value: paymentTimeout,
},
cancelableFlag,
cltvLimitFlag,
lastHopFlag,
cli.Int64SliceFlag{
Expand Down Expand Up @@ -328,6 +336,7 @@ func sendPayment(ctx *cli.Context) error {
PaymentRequest: stripPrefix(ctx.String("pay_req")),
Amt: ctx.Int64("amt"),
DestCustomRecords: make(map[uint64][]byte),
Cancelable: ctx.Bool(cancelableFlag.Name),
}

// We'll attempt to parse a payment address as well, given that
Expand Down Expand Up @@ -386,6 +395,7 @@ func sendPayment(ctx *cli.Context) error {
Amt: amount,
DestCustomRecords: make(map[uint64][]byte),
Amp: ctx.Bool(ampFlag.Name),
Cancelable: ctx.Bool(cancelableFlag.Name),
}

var rHash []byte
Expand Down Expand Up @@ -887,6 +897,7 @@ func payInvoice(ctx *cli.Context) error {
Amt: ctx.Int64("amt"),
DestCustomRecords: make(map[uint64][]byte),
Amp: ctx.Bool(ampFlag.Name),
Cancelable: ctx.Bool(cancelableFlag.Name),
}

return sendPaymentRequest(ctx, req)
Expand Down

0 comments on commit 9a3fa63

Please sign in to comment.