ln-docker-daemons 2.0.0 → 2.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/CHANGELOG.md CHANGED
@@ -1,5 +1,9 @@
1
1
  # Versions
2
2
 
3
+ ## 2.1.0
4
+
5
+ - `DOCKER_LND_VERSION`: add environment variable to control docker lnd image
6
+
3
7
  ## 2.0.0
4
8
 
5
9
  - `spawnLightningCluster`: add `socket` to reveal node LN p2p sockets
package/README.md CHANGED
@@ -18,6 +18,16 @@ const publicKey = (await getIdentity({lnd})).public_key;
18
18
  await kill({});
19
19
  ```
20
20
 
21
+ ## Environment Variables
22
+
23
+ - `DOCKER_LND_VERSION`: set this to use a custom LND docker image
24
+
25
+ Example:
26
+
27
+ ```shell
28
+ export DOCKER_LND_VERSION="v0.14.0-beta"
29
+ ```
30
+
21
31
  ## spawnBitcoindDocker
22
32
 
23
33
  Spawn a Bitcoin Core Docker image
@@ -83,11 +93,10 @@ const {spawnLightningCluster} = require('ln-docker-daemons');
83
93
  const {nodes} = await spawnLightningCluster({});
84
94
  const [{lnd, generate, kill}] = nodes;
85
95
 
86
- const pubilcKey = (await getIdentity({lnd})).public_key;
96
+ const publicKey = (await getIdentity({lnd})).public_key;
87
97
 
88
98
  // Generate some coins for the wallet
89
- const {address} = await createChainAddress({lnd, format: 'p2wpkh'});
90
- await generate({address, count: 500});
99
+ await generate({count: 500});
91
100
 
92
101
  // Stop the image
93
102
  await kill({});
@@ -17,7 +17,7 @@ const count = size => size || 1;
17
17
  const endPort = 65000;
18
18
  const generateAddress = '2N8hwP1WmJrFF5QWABn38y63uYLhnJYJYTF';
19
19
  const interval = 10;
20
- const makeAddress = ({lnd}) => createChainAddress({lnd, format: 'p2wpkh'});
20
+ const makeAddress = ({lnd}) => createChainAddress({lnd});
21
21
  const maturity = 100;
22
22
  const pairs = n => n.map((x, i) => n.slice(i + 1).map(y => [x, y])).flat();
23
23
  const portsPerLnd = 6;
@@ -46,7 +46,7 @@ module.exports = (args, cbk) => {
46
46
  return asyncAuto({
47
47
  // Spawn nodes
48
48
  spawn: async () => {
49
- return await asyncRetry({}, async () => {
49
+ return await asyncRetry({interval, times: 25}, async () => {
50
50
  const options = {startPort: between(startPort, endPort)};
51
51
 
52
52
  // Find ports for the requested daemons
@@ -67,6 +67,8 @@ module.exports = ({arguments, expose, image, ports}, cbk) => {
67
67
  throw [503, 'CannotConnectToDockerDaemon'];
68
68
  }
69
69
 
70
+ console.log("ERR", err);
71
+
70
72
  throw [503, 'UnexpectedErrorGettingDockerImage', {err}];
71
73
  }
72
74
  }],
@@ -1,3 +1,3 @@
1
1
  {
2
- "dockerLndImage": "lightninglabs/lnd:v0.13.4-beta"
2
+ "dockerLndImage": "lightninglabs/lnd:v0.14.0-beta"
3
3
  }
@@ -8,7 +8,8 @@ const {unauthenticatedLndGrpc} = require('lightning');
8
8
  const {dockerLndImage} = require('./constants');
9
9
  const {spawnDockerImage} = require('./../docker');
10
10
 
11
- const interval = 50;
11
+ const imageName = ver => !!ver ? `lightninglabs/lnd:${ver}` : dockerLndImage;
12
+ const interval = 100;
12
13
  const macaroonPath = '/root/.lnd/data/chain/bitcoin/regtest/admin.macaroon';
13
14
  const times = 500;
14
15
  const tlsCertPath = '/root/.lnd/tls.cert';
@@ -101,7 +102,7 @@ module.exports = (args, cbk) => {
101
102
  '--trickledelay=1',
102
103
  '--unsafe-disconnect',
103
104
  ],
104
- image: dockerLndImage,
105
+ image: imageName(process.env.DOCKER_LND_VERSION),
105
106
  ports: {
106
107
  '9735/tcp': args.p2p_port,
107
108
  '10009/tcp': args.rpc_port,
package/package.json CHANGED
@@ -12,7 +12,7 @@
12
12
  "asyncjs-util": "1.2.7",
13
13
  "dockerode": "3.3.1",
14
14
  "find-free-ports": "3.0.0",
15
- "lightning": "4.14.4",
15
+ "lightning": "5.0.0",
16
16
  "tar-stream": "2.2.0"
17
17
  },
18
18
  "description": "Spawn and control LN Docker daemons",
@@ -35,5 +35,5 @@
35
35
  "scripts": {
36
36
  "test": "tap --branches=1 --functions=1 --lines=1 --statements=1 -j 1 test/bitcoind/*.js test/lnd/*.js"
37
37
  },
38
- "version": "2.0.0"
38
+ "version": "2.1.0"
39
39
  }