Skip to content

Commit 0e2f3c9

Browse files
authored
Merge pull request #121 from guggero/msat-conversion
lndclient: fix Value/ValueMsat conversion problem
2 parents bb4dbc6 + fc44ee8 commit 0e2f3c9

File tree

4 files changed

+4
-6
lines changed

4 files changed

+4
-6
lines changed

lndclient/invoices_client.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -134,7 +134,7 @@ func (s *invoicesClient) AddHoldInvoice(ctx context.Context,
134134
rpcIn := &invoicesrpc.AddHoldInvoiceRequest{
135135
Memo: in.Memo,
136136
Hash: in.Hash[:],
137-
Value: int64(in.Value),
137+
ValueMsat: int64(in.Value),
138138
Expiry: in.Expiry,
139139
CltvExpiry: in.CltvExpiry,
140140
Private: true,

lndclient/lightning_client.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -323,7 +323,7 @@ func (s *lightningClient) AddInvoice(ctx context.Context,
323323

324324
rpcIn := &lnrpc.Invoice{
325325
Memo: in.Memo,
326-
Value: int64(in.Value),
326+
ValueMsat: int64(in.Value),
327327
Expiry: in.Expiry,
328328
CltvExpiry: in.CltvExpiry,
329329
Private: true,

test/invoices_mock.go

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,6 @@ import (
1010
"github.com/lightninglabs/loop/lndclient"
1111
"github.com/lightningnetwork/lnd/lnrpc/invoicesrpc"
1212
"github.com/lightningnetwork/lnd/lntypes"
13-
"github.com/lightningnetwork/lnd/lnwire"
1413
"github.com/lightningnetwork/lnd/zpay32"
1514
)
1615

@@ -77,7 +76,7 @@ func (s *mockInvoices) AddHoldInvoice(ctx context.Context,
7776
s.lnd.ChainParams, *hash, creationDate,
7877
zpay32.Description(in.Memo),
7978
zpay32.CLTVExpiry(in.CltvExpiry),
80-
zpay32.Amount(lnwire.MilliSatoshi(in.Value)),
79+
zpay32.Amount(in.Value),
8180
)
8281
if err != nil {
8382
return "", err

test/lightning_client_mock.go

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,6 @@ import (
1111
"github.com/lightninglabs/loop/lndclient"
1212
"github.com/lightningnetwork/lnd/lnrpc/invoicesrpc"
1313
"github.com/lightningnetwork/lnd/lntypes"
14-
"github.com/lightningnetwork/lnd/lnwire"
1514
"github.com/lightningnetwork/lnd/zpay32"
1615
"golang.org/x/net/context"
1716
)
@@ -88,7 +87,7 @@ func (h *mockLightningClient) AddInvoice(ctx context.Context,
8887
h.lnd.ChainParams, hash, creationDate,
8988
zpay32.Description(in.Memo),
9089
zpay32.CLTVExpiry(in.CltvExpiry),
91-
zpay32.Amount(lnwire.MilliSatoshi(in.Value)),
90+
zpay32.Amount(in.Value),
9291
)
9392
if err != nil {
9493
return lntypes.Hash{}, "", err

0 commit comments

Comments
 (0)