Skip to content

Commit b1b04ea

Browse files
committed
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 3104fa5 commit b1b04ea

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
@@ -227,7 +227,7 @@ func (s *invoicesClient) AddHoldInvoice(ctx context.Context,
227227
rpcIn := &invoicesrpc.AddHoldInvoiceRequest{
228228
Memo: in.Memo,
229229
Hash: in.Hash[:],
230-
Value: int64(in.Value.ToSatoshis()),
230+
ValueMsat: int64(in.Value),
231231
Expiry: in.Expiry,
232232
CltvExpiry: in.CltvExpiry,
233233
Private: true,

0 commit comments

Comments
 (0)