lncli: Expose cltv_expiry flag of addinvoice

Allows users of the RPC CLI to set the `min_final_cltv_expiry_delta`
described in BOLT's 11, 7, and 2 by setting the `cltv_expiry` flag when
calling either of the `addinvoice` or `addholdinvoice` RPC's from
`lncli`.
This commit is contained in:
David Gumberg 2024-02-19 11:17:57 -05:00
parent 613bfc07fb
commit 80b60d34aa
2 changed files with 18 additions and 0 deletions

View File

@ -60,6 +60,14 @@ var addInvoiceCommand = cli.Command{
"specified, an expiry of " +
"86400 seconds (24 hours) is implied.",
},
cli.Uint64Flag{
Name: "cltv_expiry_delta",
Usage: "The minimum CLTV delta to use for the final " +
"hop. If this is set to 0, the default value " +
"is used. The default value for " +
"cltv_expiry_delta is configured by the " +
"'bitcoin.timelockdelta' option.",
},
cli.BoolFlag{
Name: "private",
Usage: "encode routing hints in the invoice with " +
@ -127,6 +135,7 @@ func addInvoice(ctx *cli.Context) error {
DescriptionHash: descHash,
FallbackAddr: ctx.String("fallback_addr"),
Expiry: ctx.Int64("expiry"),
CltvExpiry: ctx.Uint64("cltv_expiry_delta"),
Private: ctx.Bool("private"),
IsAmp: ctx.Bool("amp"),
}

View File

@ -184,6 +184,14 @@ var addHoldInvoiceCommand = cli.Command{
"specified, an expiry of " +
"86400 seconds (24 hours) is implied.",
},
cli.Uint64Flag{
Name: "cltv_expiry_delta",
Usage: "The minimum CLTV delta to use for the final " +
"hop. If this is set to 0, the default value " +
"is used. The default value for " +
"cltv_expiry_delta is configured by the " +
"'bitcoin.timelockdelta' option.",
},
cli.BoolFlag{
Name: "private",
Usage: "encode routing hints in the invoice with " +
@ -241,6 +249,7 @@ func addHoldInvoice(ctx *cli.Context) error {
DescriptionHash: descHash,
FallbackAddr: ctx.String("fallback_addr"),
Expiry: ctx.Int64("expiry"),
CltvExpiry: ctx.Uint64("cltv_expiry_delta"),
Private: ctx.Bool("private"),
}