Skip to content

Commit 2822b1b

Browse files
committed
rpcserver: fix "mutually exclusive" err when using sats
If the user specifies sats but we end up setting the (validated) mSat amount, we run into the error "sat and msat arguments are mutually exclusive" in lnd. To fix that, we need to reset the sat value.
1 parent 1660f9c commit 2822b1b

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

rpcserver.go

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8056,7 +8056,13 @@ func (r *rpcServer) AddInvoice(ctx context.Context,
80568056
return nil, fmt.Errorf("error validating invoice amount: %w",
80578057
err)
80588058
}
8059+
8060+
// We'll forward the invoice request to lnd, where we can only set one
8061+
// of the two values. Since we've calculated the amount in mSat (but the
8062+
// user might've set the satoshi value initially), we need to reset the
8063+
// value field.
80598064
iReq.ValueMsat = int64(invoiceAmtMsat)
8065+
iReq.Value = 0
80608066

80618067
// The last step is to create a hop hint that includes the fake SCID of
80628068
// the quote, alongside the channel's routing policy. We need to choose

0 commit comments

Comments
 (0)