From b1b04eab22d702efad9b24044db60217b3c2c8b3 Mon Sep 17 00:00:00 2001 From: Olaoluwa Osuntokun Date: Thu, 24 Oct 2024 16:39:19 -0700 Subject: [PATCH] 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. --- invoices_client.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/invoices_client.go b/invoices_client.go index 4d2940f..540ffd7 100644 --- a/invoices_client.go +++ b/invoices_client.go @@ -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,