Skip to content

Commit

Permalink
invoiecs: fix value conversion bug in AddHodlInvoice
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
Roasbeef committed Oct 24, 2024
1 parent 3104fa5 commit b1b04ea
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion invoices_client.go
Original file line number Diff line number Diff line change
Expand Up @@ -227,7 +227,7 @@ func (s *invoicesClient) AddHoldInvoice(ctx context.Context,
rpcIn := &invoicesrpc.AddHoldInvoiceRequest{
Memo: in.Memo,
Hash: in.Hash[:],
Value: int64(in.Value.ToSatoshis()),
ValueMsat: int64(in.Value),
Expiry: in.Expiry,
CltvExpiry: in.CltvExpiry,
Private: true,
Expand Down

0 comments on commit b1b04ea

Please sign in to comment.