ln-service 53.0.0 → 53.1.2

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,6 +1,15 @@
1
1
  # Versions
2
2
 
3
- ## 53.0.0
3
+ ## 53.1.1
4
+
5
+ - `openChannels`: Fix `cooperative_close_address` not being set on channels
6
+
7
+ ## 53.1.0
8
+
9
+ - Add support for LND 0.14.1
10
+ - `openChannels`: Add `is_avoiding_broadcast` to avoid all funding broadcast
11
+
12
+ ## 53.0.1
4
13
 
5
14
  - Removed support for determining the type of channel to support LND 0.14.0.
6
15
 
package/README.md CHANGED
@@ -9,6 +9,7 @@ through npm.
9
9
 
10
10
  Supported LND versions:
11
11
 
12
+ - v0.14.0-beta to v0.14.1-beta
12
13
  - v0.13.0-beta to v0.13.4-beta
13
14
  - v0.12.0-beta to v0.12.1-beta
14
15
  - v0.11.0-beta to v0.11.1-beta
@@ -248,9 +249,13 @@ for `unlocker` methods.
248
249
  - [bolt07](https://npmjs.com/package/bolt07) - bolt07 channel gossip utilities
249
250
  - [bolt09](https://npmjs.com/package/bolt09) - bolt09 feature flag utilities
250
251
  - [invoices](https://npmjs.com/package/invoices) - bolt11 request utilities
251
- - [lightning](https://npmjs.com/package/lightning) - general lightning utilities
252
+ - [lightning](https://npmjs.com/package/lightning) - methods with typescript
253
+ typing support
252
254
  - [ln-accounting](https://npmjs.com/package/ln-accounting) - accounting records
253
- - [ln-pathfinding](https://npmjs.com/package/ln-accounting) - pathfinding utilities
255
+ - [ln-docker-daemons](https://github.com/alexbosworth/ln-docker-daemons)
256
+ - run regtest integration tests
257
+ - [ln-pathfinding](https://npmjs.com/package/ln-accounting) - pathfinding
258
+ utilities
254
259
  - [probing](https://npmjs.com/package/probing) - payment probing utilities
255
260
  - [psbt](https://www.npmjs.com/package/psbt) - BIP 174 PSBT utilities
256
261
 
@@ -3235,6 +3240,9 @@ minutes to fund the channels.
3235
3240
  If you do not fund the channels, be sure to `cancelPendingChannel`s on each
3236
3241
  channel that was not funded.
3237
3242
 
3243
+ Use `is_avoiding_broadcast` only when self-publishing the raw transaction
3244
+ after the funding step.
3245
+
3238
3246
  {
3239
3247
  channels: [{
3240
3248
  capacity: <Channel Capacity Tokens Number>
@@ -3246,6 +3254,7 @@ channel that was not funded.
3246
3254
  [partner_csv_delay]: <Peer Output CSV Delay Number>
3247
3255
  [partner_socket]: <Peer Connection Host:Port String>
3248
3256
  }]
3257
+ [is_avoiding_broadcast]: <Avoid Broadcast of All Channels Bool>
3249
3258
  lnd: <Authenticated LND API Object>
3250
3259
  }
3251
3260
 
package/package.json CHANGED
@@ -11,10 +11,10 @@
11
11
  "cors": "2.8.5",
12
12
  "express": "4.17.1",
13
13
  "invoices": "2.0.2",
14
- "lightning": "5.0.0",
14
+ "lightning": "5.1.1",
15
15
  "macaroon": "3.0.4",
16
16
  "morgan": "1.10.0",
17
- "ws": "8.2.3"
17
+ "ws": "8.3.0"
18
18
  },
19
19
  "description": "Interaction helper for your Lightning Network daemon",
20
20
  "devDependencies": {
@@ -23,7 +23,7 @@
23
23
  "async": "3.2.2",
24
24
  "asyncjs-util": "1.2.7",
25
25
  "bip66": "1.1.5",
26
- "bitcoinjs-lib": "6.0.0",
26
+ "bitcoinjs-lib": "6.0.1",
27
27
  "bn.js": "5.2.0",
28
28
  "ecpair": "1.0.1",
29
29
  "ln-docker-daemons": "2.1.0",
@@ -54,5 +54,5 @@
54
54
  "scripts": {
55
55
  "test": "echo $DOCKER_LND_VERSION && tap -j 2 --branches=1 --functions=1 --lines=1 --statements=1 -t 200 test/autopilotrpc-integration/*.js test/chainrpc-integration/*.js test/integration/*.js test/invoicesrpc-integration/*.js test/routerrpc-integration/*.js test/signerrpc-integration/*.js test/tower_clientrpc-integration/*.js test/tower_serverrpc-integration/*.js test/walletrpc-integration/*.js"
56
56
  },
57
- "version": "53.0.0"
57
+ "version": "53.1.2"
58
58
  }
@@ -1,3 +1,4 @@
1
+ const asyncMap = require('async/map');
1
2
  const asyncRetry = require('async/retry');
2
3
  const {extractTransaction} = require('psbt');
3
4
  const {finalizePsbt} = require('psbt');
@@ -6,22 +7,25 @@ const {test} = require('@alexbosworth/tap');
6
7
  const {transactionAsPsbt} = require('psbt');
7
8
 
8
9
  const {addPeer} = require('./../../');
10
+ const {createChainAddress} = require('./../../');
9
11
  const {delay} = require('./../macros');
10
12
  const {fundPendingChannels} = require('./../../');
11
13
  const {getChainBalance} = require('./../../');
12
14
  const {getChainTransactions} = require('./../../');
13
15
  const {getChannels} = require('./../../');
16
+ const {getHeight} = require('./../../');
14
17
  const {getPeers} = require('./../../');
15
18
  const {openChannels} = require('./../../');
16
19
  const {sendToChainAddresses} = require('./../../');
17
20
 
18
21
  const capacity = 1e6;
19
22
  const count = 10;
20
- const interval = 1;
23
+ const interval = 10;
24
+ const maturity = 100;
21
25
  const race = promises => Promise.race(promises);
22
26
  const size = 3;
23
27
  const timeout = 250 * 10;
24
- const times = 200;
28
+ const times = 2000;
25
29
 
26
30
  // Opening channels should open up channels
27
31
  test(`Open channels`, async ({end, equal}) => {
@@ -29,11 +33,19 @@ test(`Open channels`, async ({end, equal}) => {
29
33
 
30
34
  const [{generate, lnd}, target, remote] = nodes;
31
35
 
32
- await asyncRetry({times}, async () => {
33
- if (!(await getChainBalance({lnd})).chain_balance) {
34
- await generate({});
36
+ await generate({count: maturity});
37
+
38
+ await asyncRetry({interval, times}, async () => {
39
+ const lnds = [lnd, target.lnd, remote.lnd];
40
+
41
+ const heights = await asyncMap(lnds, async lnd => {
42
+ return (await getHeight({lnd})).current_block_height;
43
+ });
44
+
45
+ const [controlHeight, targetHeight, remoteHeight] = heights;
35
46
 
36
- throw new Error('ExpectedChainBalanceToOpenChannel');
47
+ if (controlHeight !== targetHeight || controlHeight !== remoteHeight) {
48
+ throw new Error('ExpectedSyncHeights');
37
49
  }
38
50
  });
39
51
 
@@ -42,11 +54,12 @@ test(`Open channels`, async ({end, equal}) => {
42
54
 
43
55
  const spending = chainTx.map(({transaction}) => transaction);
44
56
 
45
- await addPeer({lnd, public_key: remote.id, socket: remote.socket});
57
+ const {address} = await createChainAddress({lnd});
46
58
 
47
- const channels = [target, remote].map(node => ({
59
+ const channels = [target, remote].map(({id}) => ({
48
60
  capacity,
49
- partner_public_key: node.id,
61
+ cooperative_close_address: address,
62
+ partner_public_key: id,
50
63
  }));
51
64
 
52
65
  let pending;
@@ -54,6 +67,7 @@ test(`Open channels`, async ({end, equal}) => {
54
67
  // Wait for peers to be connected
55
68
  await asyncRetry({interval, times}, async () => {
56
69
  await addPeer({lnd, public_key: remote.id, socket: remote.socket});
70
+ await addPeer({lnd, public_key: target.id, socket: target.socket});
57
71
 
58
72
  if ((await getPeers({lnd})).peers.length !== channels.length) {
59
73
  throw new Error('ExpectedConnectedPeersToOpenChannels');
@@ -67,13 +81,13 @@ test(`Open channels`, async ({end, equal}) => {
67
81
  });
68
82
 
69
83
  // Normally funding would involve an un-broadcast transaction
70
- await sendToChainAddresses({lnd, send_to: pending});
84
+ const {id} = await sendToChainAddresses({lnd, send_to: pending});
71
85
 
72
- await asyncRetry({interval, times}, async() => {
86
+ await asyncRetry({interval, times}, async () => {
73
87
  const {transactions} = await getChainTransactions({lnd});
74
88
 
75
- if (transactions.length !== pending.length) {
76
- throw new Error('ExpectedMultipleChainTransactions');
89
+ if (!transactions.find(n => n.id === id)) {
90
+ throw new Error('ExpectedChainTransaction');
77
91
  }
78
92
 
79
93
  return;
@@ -96,7 +110,7 @@ test(`Open channels`, async ({end, equal}) => {
96
110
  });
97
111
 
98
112
  await asyncRetry({interval, times}, async () => {
99
- await generate({count});
113
+ await generate({});
100
114
 
101
115
  const {channels} = await getChannels({lnd});
102
116
 
@@ -104,8 +118,14 @@ test(`Open channels`, async ({end, equal}) => {
104
118
  throw new Error('ExpectedNewChannelsCreatedAndActive');
105
119
  }
106
120
 
121
+ const [channel] = channels;
122
+
123
+ equal(channel.cooperative_close_address, address, 'Channel close addr');
124
+
107
125
  return;
108
126
  });
127
+ } catch (err) {
128
+ equal(err, null, 'No error is reported');
109
129
  } finally {
110
130
  return await kill({});
111
131
  }