From fc44ee878529d7a4a6cfc46c4b8f4faef08a066e Mon Sep 17 00:00:00 2001 From: Oliver Gugger Date: Tue, 3 Dec 2019 10:42:01 +0100 Subject: [PATCH] lndclient: fix Value/ValueMsat conversion problem --- lndclient/invoices_client.go | 2 +- lndclient/lightning_client.go | 2 +- test/invoices_mock.go | 3 +-- test/lightning_client_mock.go | 3 +-- 4 files changed, 4 insertions(+), 6 deletions(-) diff --git a/lndclient/invoices_client.go b/lndclient/invoices_client.go index 11841b2..48f7ac4 100644 --- a/lndclient/invoices_client.go +++ b/lndclient/invoices_client.go @@ -134,7 +134,7 @@ func (s *invoicesClient) AddHoldInvoice(ctx context.Context, rpcIn := &invoicesrpc.AddHoldInvoiceRequest{ Memo: in.Memo, Hash: in.Hash[:], - Value: int64(in.Value), + ValueMsat: int64(in.Value), Expiry: in.Expiry, CltvExpiry: in.CltvExpiry, Private: true, diff --git a/lndclient/lightning_client.go b/lndclient/lightning_client.go index 0af1028..a819d0d 100644 --- a/lndclient/lightning_client.go +++ b/lndclient/lightning_client.go @@ -323,7 +323,7 @@ func (s *lightningClient) AddInvoice(ctx context.Context, rpcIn := &lnrpc.Invoice{ Memo: in.Memo, - Value: int64(in.Value), + ValueMsat: int64(in.Value), Expiry: in.Expiry, CltvExpiry: in.CltvExpiry, Private: true, diff --git a/test/invoices_mock.go b/test/invoices_mock.go index 6b216bd..d8cf41f 100644 --- a/test/invoices_mock.go +++ b/test/invoices_mock.go @@ -10,7 +10,6 @@ import ( "github.com/lightninglabs/loop/lndclient" "github.com/lightningnetwork/lnd/lnrpc/invoicesrpc" "github.com/lightningnetwork/lnd/lntypes" - "github.com/lightningnetwork/lnd/lnwire" "github.com/lightningnetwork/lnd/zpay32" ) @@ -77,7 +76,7 @@ func (s *mockInvoices) AddHoldInvoice(ctx context.Context, s.lnd.ChainParams, *hash, creationDate, zpay32.Description(in.Memo), zpay32.CLTVExpiry(in.CltvExpiry), - zpay32.Amount(lnwire.MilliSatoshi(in.Value)), + zpay32.Amount(in.Value), ) if err != nil { return "", err diff --git a/test/lightning_client_mock.go b/test/lightning_client_mock.go index 6ab004e..07bf19e 100644 --- a/test/lightning_client_mock.go +++ b/test/lightning_client_mock.go @@ -11,7 +11,6 @@ import ( "github.com/lightninglabs/loop/lndclient" "github.com/lightningnetwork/lnd/lnrpc/invoicesrpc" "github.com/lightningnetwork/lnd/lntypes" - "github.com/lightningnetwork/lnd/lnwire" "github.com/lightningnetwork/lnd/zpay32" "golang.org/x/net/context" ) @@ -88,7 +87,7 @@ func (h *mockLightningClient) AddInvoice(ctx context.Context, h.lnd.ChainParams, hash, creationDate, zpay32.Description(in.Memo), zpay32.CLTVExpiry(in.CltvExpiry), - zpay32.Amount(lnwire.MilliSatoshi(in.Value)), + zpay32.Amount(in.Value), ) if err != nil { return lntypes.Hash{}, "", err