mirror of
https://github.com/lightningnetwork/lnd.git
synced 2025-03-04 09:48:19 +01:00
Merge pull request #5002 from akovalenko/master
lncli addinvoice: allow specifying msat with --amt_msat
This commit is contained in:
commit
e2690918a0
1 changed files with 9 additions and 4 deletions
|
@ -37,6 +37,10 @@ var addInvoiceCommand = cli.Command{
|
||||||
Name: "amt",
|
Name: "amt",
|
||||||
Usage: "the amt of satoshis in this invoice",
|
Usage: "the amt of satoshis in this invoice",
|
||||||
},
|
},
|
||||||
|
cli.Int64Flag{
|
||||||
|
Name: "amt_msat",
|
||||||
|
Usage: "the amt of millisatoshis in this invoice",
|
||||||
|
},
|
||||||
cli.StringFlag{
|
cli.StringFlag{
|
||||||
Name: "description_hash",
|
Name: "description_hash",
|
||||||
Usage: "SHA-256 hash of the description of the payment. " +
|
Usage: "SHA-256 hash of the description of the payment. " +
|
||||||
|
@ -71,6 +75,7 @@ func addInvoice(ctx *cli.Context) error {
|
||||||
preimage []byte
|
preimage []byte
|
||||||
descHash []byte
|
descHash []byte
|
||||||
amt int64
|
amt int64
|
||||||
|
amtMsat int64
|
||||||
err error
|
err error
|
||||||
)
|
)
|
||||||
ctxc := getContext()
|
ctxc := getContext()
|
||||||
|
@ -79,10 +84,9 @@ func addInvoice(ctx *cli.Context) error {
|
||||||
|
|
||||||
args := ctx.Args()
|
args := ctx.Args()
|
||||||
|
|
||||||
switch {
|
|
||||||
case ctx.IsSet("amt"):
|
|
||||||
amt = ctx.Int64("amt")
|
amt = ctx.Int64("amt")
|
||||||
case args.Present():
|
amtMsat = ctx.Int64("amt_msat")
|
||||||
|
if !ctx.IsSet("amt") && !ctx.IsSet("amt_msat") && args.Present() {
|
||||||
amt, err = strconv.ParseInt(args.First(), 10, 64)
|
amt, err = strconv.ParseInt(args.First(), 10, 64)
|
||||||
args = args.Tail()
|
args = args.Tail()
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
@ -110,6 +114,7 @@ func addInvoice(ctx *cli.Context) error {
|
||||||
Memo: ctx.String("memo"),
|
Memo: ctx.String("memo"),
|
||||||
RPreimage: preimage,
|
RPreimage: preimage,
|
||||||
Value: amt,
|
Value: amt,
|
||||||
|
ValueMsat: amtMsat,
|
||||||
DescriptionHash: descHash,
|
DescriptionHash: descHash,
|
||||||
FallbackAddr: ctx.String("fallback_addr"),
|
FallbackAddr: ctx.String("fallback_addr"),
|
||||||
Expiry: ctx.Int64("expiry"),
|
Expiry: ctx.Int64("expiry"),
|
||||||
|
|
Loading…
Add table
Reference in a new issue