Skip to content

Commit ba3b2a0

Browse files
committed
cmd: ln addinvoice supports msat amount
1 parent 131eda1 commit ba3b2a0

File tree

1 file changed

+17
-4
lines changed

1 file changed

+17
-4
lines changed

cmd/litcli/ln.go

Lines changed: 17 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -659,8 +659,14 @@ var addInvoiceCommand = cli.Command{
659659
"cannot be used at the same time as --asset_id",
660660
},
661661
cli.Uint64Flag{
662-
Name: "asset_amount",
663-
Usage: "the amount of assets to receive",
662+
Name: "asset_amount",
663+
Usage: "the amount of assets to receive, mutually " +
664+
"exclusive to msat_amount",
665+
},
666+
cli.Uint64Flag{
667+
Name: "msat_amount",
668+
Usage: "the amount of msats to receive, mutually " +
669+
"exclusive to asset_amount",
664670
},
665671
cli.StringFlag{
666672
Name: "rfq_peer_pubkey",
@@ -679,12 +685,18 @@ func addInvoice(cli *cli.Context) error {
679685

680686
var (
681687
assetAmount = cli.Uint64("asset_amount")
688+
msatAmount = cli.Uint64("msat_amount")
682689
preimage []byte
683690
descHash []byte
684691
err error
685692
)
686-
if assetAmount == 0 {
687-
return fmt.Errorf("asset_amount argument missing")
693+
if assetAmount == 0 && msatAmount == 0 {
694+
return fmt.Errorf("must set asset amount or msat amount")
695+
}
696+
697+
if assetAmount != 0 && msatAmount != 0 {
698+
return fmt.Errorf("must only set one of asset amount or msat " +
699+
"amount")
688700
}
689701

690702
if cli.IsSet("preimage") {
@@ -731,6 +743,7 @@ func addInvoice(cli *cli.Context) error {
731743
Memo: cli.String("memo"),
732744
RPreimage: preimage,
733745
DescriptionHash: descHash,
746+
ValueMsat: int64(msatAmount),
734747
FallbackAddr: cli.String("fallback_addr"),
735748
Expiry: expirySeconds,
736749
Private: cli.Bool("private"),

0 commit comments

Comments
 (0)