Skip to content

Commit e99202c

Browse files
authored
Merge pull request #181 from guggero/lnd-version-aware
Make loop aware of lnd's version
2 parents 23d646e + e7f41fa commit e99202c

10 files changed

+617
-80
lines changed

README.md

Lines changed: 18 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -57,25 +57,36 @@ problems. Community support is also available in the
5757
LND and the loop client are using Go modules. Make sure that the `GO111MODULE`
5858
env variable is set to `on`.
5959

60-
In order to execute a swap, **You need to run lnd 0.7.1+, or master built with
61-
sub-servers enabled.**
60+
In order to execute a swap, **you need to run a compatible lnd version built
61+
with the correct sub-servers enabled.**
6262

6363
### LND
6464

65-
If you are building from source, and not using a 0.7.1 or higher release of
66-
lnd, make sure that you are using the `master` branch of lnd. You can get this
67-
by git cloning the repository
65+
To run loop, you need a compatible version of `lnd` running. It is generally
66+
recommended to always keep both `lnd` and `loop` updated to the most recent
67+
released version. If you need to run an older version of `lnd`, please consult
68+
the following table for supported versions.
69+
70+
Loop Version | Compatible LND Version(s)
71+
------------------|------------------
72+
`>= v0.6.0-beta` | `v0.10.x-beta`
73+
`<= 0.5.1-beta` | `v0.7.1-beta` - `v0.10.x-beta`
74+
75+
If you are building from source make sure you are using the latest tagged
76+
version of lnd. You can get this by git cloning the repository and checking out
77+
a specific tag:
6878

6979
```
7080
git clone https://github.com/lightningnetwork/lnd.git
81+
cd lnd
82+
git checkout v0.10.0-beta
7183
```
7284

7385
Once the lnd repository is cloned, it will need to be built with special build
7486
tags that enable the swap. This enables the required lnd rpc services.
7587

7688
```
77-
cd lnd
78-
make install tags="signrpc walletrpc chainrpc invoicesrpc routerrpc"
89+
make install tags="signrpc walletrpc chainrpc invoicesrpc"
7990
```
8091

8192
Check to see if you have already installed lnd. If you have, you will need to

client.go

Lines changed: 3 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,7 @@ package loop
22

33
import (
44
"context"
5-
"encoding/hex"
65
"errors"
7-
"fmt"
86
"strings"
97
"sync"
108
"sync/atomic"
@@ -211,13 +209,9 @@ func (s *Client) Run(ctx context.Context,
211209
}
212210

213211
// Log connected node.
214-
info, err := s.lndServices.Client.GetInfo(ctx)
215-
if err != nil {
216-
return fmt.Errorf("GetInfo error: %v", err)
217-
}
218-
log.Infof("Connected to lnd node %v with pubkey %v",
219-
info.Alias, hex.EncodeToString(info.IdentityPubkey[:]),
220-
)
212+
log.Infof("Connected to lnd node '%v' with pubkey %x (version %s)",
213+
s.lndServices.NodeAlias, s.lndServices.NodePubkey,
214+
lndclient.VersionString(s.lndServices.Version))
221215

222216
// Setup main context used for cancelation.
223217
mainCtx, mainCancel := context.WithCancel(ctx)

client_test.go

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -35,14 +35,13 @@ var (
3535
prepayInvoiceDesc = "prepay"
3636
)
3737

38-
// TestSuccess tests the uncharge happy flow.
38+
// TestSuccess tests the loop out happy flow.
3939
func TestSuccess(t *testing.T) {
4040
defer test.Guard(t)()
4141

4242
ctx := createClientTestContext(t, nil)
4343

44-
// Initiate uncharge.
45-
44+
// Initiate loop out.
4645
hash, _, err := ctx.swapClient.LoopOut(context.Background(), testRequest)
4746
if err != nil {
4847
t.Fatal(err)
@@ -54,7 +53,7 @@ func TestSuccess(t *testing.T) {
5453
signalSwapPaymentResult := ctx.AssertPaid(swapInvoiceDesc)
5554
signalPrepaymentResult := ctx.AssertPaid(prepayInvoiceDesc)
5655

57-
// Expect client to register for conf
56+
// Expect client to register for conf.
5857
confIntent := ctx.AssertRegisterConf()
5958

6059
testSuccess(ctx, testRequest.Amount, *hash,
@@ -228,7 +227,7 @@ func testResume(t *testing.T, expired, preimageRevealed, expectSuccess bool) {
228227
signalSwapPaymentResult := ctx.AssertPaid(swapInvoiceDesc)
229228
signalPrepaymentResult := ctx.AssertPaid(prepayInvoiceDesc)
230229

231-
// Expect client to register for conf
230+
// Expect client to register for conf.
232231
confIntent := ctx.AssertRegisterConf()
233232

234233
signalSwapPaymentResult(nil)

0 commit comments

Comments
 (0)