Skip to content

Commit 17ab5e2

Browse files
committed
cmd: ln addinvoice supports sat/msat amount
1 parent 0015ca2 commit 17ab5e2

File tree

1 file changed

+15
-2
lines changed

1 file changed

+15
-2
lines changed

cmd/litcli/ln.go

Lines changed: 15 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -679,12 +679,23 @@ func addInvoice(cli *cli.Context) error {
679679

680680
var (
681681
assetAmount = cli.Uint64("asset_amount")
682+
msatAmount = cli.Int64("amt_msat")
683+
satAmount = cli.Int64("amt")
682684
preimage []byte
683685
descHash []byte
684686
err error
685687
)
686-
if assetAmount == 0 {
687-
return fmt.Errorf("asset_amount argument missing")
688+
if assetAmount == 0 && msatAmount == 0 && satAmount == 0 {
689+
return fmt.Errorf("must set asset amount or sat/msat amount")
690+
}
691+
692+
if assetAmount != 0 && (msatAmount != 0 || satAmount != 0) {
693+
return fmt.Errorf("must only set one of asset amount or " +
694+
"sat/msat amount")
695+
}
696+
697+
if msatAmount != 0 && satAmount != 0 {
698+
return fmt.Errorf("must only set one of amt or amt_msat")
688699
}
689700

690701
if cli.IsSet("preimage") {
@@ -731,6 +742,8 @@ func addInvoice(cli *cli.Context) error {
731742
Memo: cli.String("memo"),
732743
RPreimage: preimage,
733744
DescriptionHash: descHash,
745+
Value: satAmount,
746+
ValueMsat: msatAmount,
734747
FallbackAddr: cli.String("fallback_addr"),
735748
Expiry: expirySeconds,
736749
Private: cli.Bool("private"),

0 commit comments

Comments
 (0)