Merge pull request #3745 from akovalenko/master
lncli addholdinvoice: allow specifying msat with --amt_msat
This commit is contained in:
commit
1fb28b6cd9
@ -160,6 +160,10 @@ var addHoldInvoiceCommand = 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. " +
|
||||||
@ -192,7 +196,6 @@ var addHoldInvoiceCommand = cli.Command{
|
|||||||
func addHoldInvoice(ctx *cli.Context) error {
|
func addHoldInvoice(ctx *cli.Context) error {
|
||||||
var (
|
var (
|
||||||
descHash []byte
|
descHash []byte
|
||||||
amt int64
|
|
||||||
err error
|
err error
|
||||||
)
|
)
|
||||||
|
|
||||||
@ -212,12 +215,11 @@ func addHoldInvoice(ctx *cli.Context) error {
|
|||||||
|
|
||||||
args = args.Tail()
|
args = args.Tail()
|
||||||
|
|
||||||
switch {
|
amt := ctx.Int64("amt")
|
||||||
case ctx.IsSet("amt"):
|
amtMsat := ctx.Int64("amt_msat")
|
||||||
amt = ctx.Int64("amt")
|
|
||||||
case args.Present():
|
|
||||||
amt, err = strconv.ParseInt(args.First(), 10, 64)
|
|
||||||
|
|
||||||
|
if !ctx.IsSet("amt") && !ctx.IsSet("amt_msat") && args.Present() {
|
||||||
|
amt, err = strconv.ParseInt(args.First(), 10, 64)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return fmt.Errorf("unable to decode amt argument: %v", err)
|
return fmt.Errorf("unable to decode amt argument: %v", err)
|
||||||
}
|
}
|
||||||
@ -236,6 +238,7 @@ func addHoldInvoice(ctx *cli.Context) error {
|
|||||||
Memo: ctx.String("memo"),
|
Memo: ctx.String("memo"),
|
||||||
Hash: hash,
|
Hash: hash,
|
||||||
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…
Reference in New Issue
Block a user