Skip to content

Commit 93d663c

Browse files
Roasbeefguggero
authored andcommitted
invoiecs: fix value conversion bug in AddHodlInvoice
Before this commit, callers wouldn't be able to use an msat amount as input to the hold invoice RPC call. Instead, the wrapper logic would always convert to msat first, causing a loss in precision. For most cases, sat amounts are fine, but some use cases require higher precision. We fix this by keeping the input value in mSat (as typed), while using the `ValueMsat` field as `lnd` would expect.
1 parent 0c9b6a5 commit 93d663c

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

invoices_client.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -151,7 +151,7 @@ func (s *invoicesClient) AddHoldInvoice(ctx context.Context,
151151
rpcIn := &invoicesrpc.AddHoldInvoiceRequest{
152152
Memo: in.Memo,
153153
Hash: in.Hash[:],
154-
Value: int64(in.Value.ToSatoshis()),
154+
ValueMsat: int64(in.Value),
155155
Expiry: in.Expiry,
156156
CltvExpiry: in.CltvExpiry,
157157
Private: true,

0 commit comments

Comments
 (0)