mirror of
https://github.com/lightningnetwork/lnd.git
synced 2025-05-24 10:40:10 +02:00
lncli: add --blind option to addinvoice
In this commit, we expose the option to create an invoice containing blinded paths to lncli.
This commit is contained in:
parent
de975334cd
commit
18cb7f0b87
@ -82,6 +82,14 @@ var addInvoiceCommand = cli.Command{
|
|||||||
Usage: "creates an AMP invoice. If true, preimage " +
|
Usage: "creates an AMP invoice. If true, preimage " +
|
||||||
"should not be set.",
|
"should not be set.",
|
||||||
},
|
},
|
||||||
|
cli.BoolFlag{
|
||||||
|
Name: "blind",
|
||||||
|
Usage: "creates an invoice that contains blinded " +
|
||||||
|
"paths. Note that invoices with blinded " +
|
||||||
|
"paths will be signed using a random " +
|
||||||
|
"ephemeral key so as not to reveal the real " +
|
||||||
|
"node ID of this node.",
|
||||||
|
},
|
||||||
},
|
},
|
||||||
Action: actionDecorator(addInvoice),
|
Action: actionDecorator(addInvoice),
|
||||||
}
|
}
|
||||||
@ -127,6 +135,11 @@ func addInvoice(ctx *cli.Context) error {
|
|||||||
return fmt.Errorf("unable to parse description_hash: %w", err)
|
return fmt.Errorf("unable to parse description_hash: %w", err)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if ctx.IsSet("private") && ctx.IsSet("blind") {
|
||||||
|
return fmt.Errorf("cannot include both route hints and " +
|
||||||
|
"blinded paths in the same invoice")
|
||||||
|
}
|
||||||
|
|
||||||
invoice := &lnrpc.Invoice{
|
invoice := &lnrpc.Invoice{
|
||||||
Memo: ctx.String("memo"),
|
Memo: ctx.String("memo"),
|
||||||
RPreimage: preimage,
|
RPreimage: preimage,
|
||||||
@ -138,6 +151,7 @@ func addInvoice(ctx *cli.Context) error {
|
|||||||
CltvExpiry: ctx.Uint64("cltv_expiry_delta"),
|
CltvExpiry: ctx.Uint64("cltv_expiry_delta"),
|
||||||
Private: ctx.Bool("private"),
|
Private: ctx.Bool("private"),
|
||||||
IsAmp: ctx.Bool("amp"),
|
IsAmp: ctx.Bool("amp"),
|
||||||
|
Blind: ctx.Bool("blind"),
|
||||||
}
|
}
|
||||||
|
|
||||||
resp, err := client.AddInvoice(ctxc, invoice)
|
resp, err := client.AddInvoice(ctxc, invoice)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user