ln-service 54.10.5 → 54.10.7

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,6 @@
1
1
  # Versions
2
2
 
3
- ## 54.10.5
3
+ ## 54.10.7
4
4
 
5
5
  - `signChainAddressMessage`: Add method to sign a message given a chain address
6
6
  - `verifyChainAddressMessage`: Add method to verify a chain address message
package/README.md CHANGED
@@ -9,6 +9,7 @@ through npm.
9
9
 
10
10
  Supported LND versions:
11
11
 
12
+ - v0.16.0-beta
12
13
  - v0.15.2-beta to v0.15.5-beta
13
14
  - v0.14.4-beta to v0.14.5-beta
14
15
 
package/package.json CHANGED
@@ -11,7 +11,7 @@
11
11
  "cors": "2.8.5",
12
12
  "express": "4.18.2",
13
13
  "invoices": "2.2.3",
14
- "lightning": "7.1.4",
14
+ "lightning": "7.1.9",
15
15
  "macaroon": "3.0.4",
16
16
  "morgan": "1.10.0",
17
17
  "ws": "8.13.0"
@@ -28,11 +28,11 @@
28
28
  "bn.js": "5.2.1",
29
29
  "bs58check": "3.0.1",
30
30
  "ecpair": "2.1.0",
31
- "ln-docker-daemons": "4.1.2",
31
+ "ln-docker-daemons": "4.1.3",
32
32
  "p2tr": "1.3.3",
33
33
  "portfinder": "1.0.32",
34
34
  "psbt": "2.7.2",
35
- "rimraf": "4.4.0",
35
+ "rimraf": "4.4.1",
36
36
  "secp256k1": "5.0.0",
37
37
  "tiny-secp256k1": "2.2.1",
38
38
  "uuid": "9.0.0",
@@ -56,6 +56,7 @@
56
56
  "url": "https://github.com/alexbosworth/ln-service.git"
57
57
  },
58
58
  "scripts": {
59
+ "integration-test-0.16.0": "DOCKER_LND_VERSION=v0.16.0-beta npm run test",
59
60
  "integration-test-0.15.5": "DOCKER_LND_VERSION=v0.15.5-beta npm run test",
60
61
  "integration-test-0.15.4": "DOCKER_LND_VERSION=v0.15.4-beta npm run test",
61
62
  "integration-test-0.15.3": "DOCKER_LND_VERSION=v0.15.3-beta npm run test",
@@ -64,5 +65,5 @@
64
65
  "integration-test-0.14.4": "DOCKER_LND_VERSION=v0.14.4-beta npm run test",
65
66
  "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/peersrpc-integration/*.js test/routerrpc-integration/*.js test/signerrpc-integration/*.js test/tower_clientrpc-integration/*.js test/tower_serverrpc-integration/*.js test/walletrpc-integration/*.js"
66
67
  },
67
- "version": "54.10.5"
68
+ "version": "54.10.7"
68
69
  }
@@ -30,7 +30,7 @@ const interval = 100;
30
30
  const race = promises => Promise.race(promises);
31
31
  const size = 3;
32
32
  const timeout = 1000 * 20;
33
- const times = 200;
33
+ const times = 300;
34
34
 
35
35
  // Forfeiting a pending channel should remove the pending channel
36
36
  test(`Forfeit pending channel`, async ({end, equal, strictSame}) => {
@@ -12,147 +12,153 @@ const {subscribeToGraph} = require('./../../');
12
12
  const capacity = 1e6;
13
13
  const interval = 10;
14
14
  const size = 2;
15
- const times = 2000;
15
+ const times = 1000;
16
16
 
17
17
  // Subscribing to graph should trigger graph events
18
18
  test('Subscribe to channels', async ({end, equal, fail, strictSame}) => {
19
- const {kill, nodes} = await spawnLightningCluster({size});
19
+ await asyncRetry({interval, times}, async () => {
20
+ const {kill, nodes} = await spawnLightningCluster({size});
20
21
 
21
- const [control, target] = nodes;
22
+ const [control, target] = nodes;
22
23
 
23
- const {generate, lnd} = control;
24
+ const {generate, lnd} = control;
24
25
 
25
- const channelClosed = [];
26
- const channelUpdated = [];
27
- const nodeUpdated = [];
28
- const {socket} = target;
26
+ const channelClosed = [];
27
+ const channelUpdated = [];
28
+ const nodeUpdated = [];
29
+ const {socket} = target;
29
30
 
30
- await delay(3000);
31
+ await delay(3000);
31
32
 
32
- const sub = subscribeToGraph({lnd});
33
+ const sub = subscribeToGraph({lnd});
33
34
 
34
- sub.on('channel_closed', update => channelClosed.push(update));
35
- sub.on('channel_updated', update => channelUpdated.push(update));
36
- sub.on('node_updated', update => nodeUpdated.push(update));
37
- sub.on('err', err => {});
35
+ sub.on('channel_closed', update => channelClosed.push(update));
36
+ sub.on('channel_updated', update => channelUpdated.push(update));
37
+ sub.on('node_updated', update => nodeUpdated.push(update));
38
+ sub.on('err', err => {});
38
39
 
39
- const channel = await setupChannel({
40
- capacity,
41
- generate,
42
- lnd,
43
- to: target,
44
- });
40
+ try {
41
+ const channel = await setupChannel({
42
+ capacity,
43
+ generate,
44
+ lnd,
45
+ to: target,
46
+ });
45
47
 
46
- const {id} = channel;
48
+ const {id} = channel;
47
49
 
48
- const channelPolicies = await getChannel({id, lnd});
50
+ const channelPolicies = await getChannel({id, lnd});
49
51
 
50
- await asyncRetry({interval, times}, async () => {
51
- await addPeer({lnd, public_key: target.id, socket: target.socket});
52
+ await asyncRetry({interval, times}, async () => {
53
+ await addPeer({lnd, public_key: target.id, socket: target.socket});
52
54
 
53
- if (!channelUpdated.length) {
54
- throw new Error('ExpectedChannelUpdated');
55
- }
55
+ if (!channelUpdated.length) {
56
+ throw new Error('ExpectedChannelUpdated');
57
+ }
56
58
 
57
- if (nodeUpdated.length !== [control, target].length) {
58
- throw new Error('ExpectedNodesUpdated');
59
- }
59
+ if (nodeUpdated.length !== [control, target].length) {
60
+ throw new Error('ExpectedNodesUpdated');
61
+ }
60
62
 
61
- return;
62
- });
63
+ return;
64
+ });
63
65
 
64
- await closeChannel({id, lnd})
66
+ await closeChannel({id, lnd})
65
67
 
66
- await asyncRetry({interval, times}, async () => {
67
- await generate({});
68
+ await asyncRetry({interval, times}, async () => {
69
+ await generate({});
68
70
 
69
- if (!channelClosed.length) {
70
- throw new Error('ExpectedChannelClosed');
71
- }
71
+ if (!channelClosed.length) {
72
+ throw new Error('ExpectedChannelClosed');
73
+ }
72
74
 
73
- return;
74
- });
75
+ return;
76
+ });
75
77
 
76
- const [channelClose] = channelClosed;
77
-
78
- equal(channelClose.capacity, capacity, 'Got closed channel capacity');
79
- equal(!!channelClose.close_height, true, 'Got closed channel height');
80
- equal(channelClose.id, id, 'Got closed channel id');
81
- equal(channelClose.transaction_id, channel.transaction_id, 'Got close tx');
82
- equal(channelClose.transaction_vout, channel.transaction_vout, 'Got vout');
83
- equal(!!channelClose.updated_at, true, 'Got close updated at');
84
-
85
- const expectedUpdates = channelPolicies.policies.map(policy => {
86
- const peer = channelPolicies.policies
87
- .find(n => n.public_key !== policy.public_key);
88
-
89
- return {
90
- capacity,
91
- id,
92
- base_fee_mtokens: policy.base_fee_mtokens,
93
- cltv_delta: policy.cltv_delta,
94
- fee_rate: policy.fee_rate,
95
- is_disabled: policy.is_disabled,
96
- max_htlc_mtokens: policy.max_htlc_mtokens,
97
- min_htlc_mtokens: policy.min_htlc_mtokens,
98
- public_keys: [policy.public_key, peer.public_key],
99
- transaction_id: channel.transaction_id,
100
- transaction_vout: channel.transaction_vout,
101
- };
102
- });
78
+ const [channelClose] = channelClosed;
103
79
 
104
- expectedUpdates.forEach(update => {
105
- const [key1, key2] = update.public_keys;
80
+ equal(channelClose.capacity, capacity, 'Got closed channel capacity');
81
+ equal(!!channelClose.close_height, true, 'Got closed channel height');
82
+ equal(channelClose.id, id, 'Got closed channel id');
83
+ equal(channelClose.transaction_id, channel.transaction_id, 'Got close tx');
84
+ equal(channelClose.transaction_vout, channel.transaction_vout, 'Got vout');
85
+ equal(!!channelClose.updated_at, true, 'Got close updated at');
106
86
 
107
- const gotUpdate = channelUpdated.find(chan => {
108
- const [k1, k2] = chan.public_keys;
87
+ const expectedUpdates = channelPolicies.policies.map(policy => {
88
+ const peer = channelPolicies.policies
89
+ .find(n => n.public_key !== policy.public_key);
109
90
 
110
- return key1 === k1 && key2 === k2;
111
- });
91
+ return {
92
+ capacity,
93
+ id,
94
+ base_fee_mtokens: policy.base_fee_mtokens,
95
+ cltv_delta: policy.cltv_delta,
96
+ fee_rate: policy.fee_rate,
97
+ is_disabled: policy.is_disabled,
98
+ max_htlc_mtokens: policy.max_htlc_mtokens,
99
+ min_htlc_mtokens: policy.min_htlc_mtokens,
100
+ public_keys: [policy.public_key, peer.public_key],
101
+ transaction_id: channel.transaction_id,
102
+ transaction_vout: channel.transaction_vout,
103
+ };
104
+ });
112
105
 
113
- equal(!!gotUpdate.updated_at, true, 'Got updated at policy date');
106
+ expectedUpdates.forEach(update => {
107
+ const [key1, key2] = update.public_keys;
114
108
 
115
- delete gotUpdate.updated_at;
109
+ const gotUpdate = channelUpdated.find(chan => {
110
+ const [k1, k2] = chan.public_keys;
116
111
 
117
- strictSame(gotUpdate, update, 'Got expected channel policy announcement');
112
+ return key1 === k1 && key2 === k2;
113
+ });
118
114
 
119
- return;
120
- });
115
+ equal(!!gotUpdate.updated_at, true, 'Got updated at policy date');
116
+
117
+ delete gotUpdate.updated_at;
121
118
 
119
+ strictSame(gotUpdate, update, 'Got expected channel policy announcement');
122
120
 
123
- const gotControl = nodeUpdated.find(n => n.public_key === control.id);
121
+ return;
122
+ });
124
123
 
125
- const expectedControl = {
126
- alias: control.id.substring(0, 20),
127
- color: '#3399ff',
128
- public_key: control.id,
129
- sockets: gotControl.sockets,
130
- };
131
124
 
132
- const gotTarget = nodeUpdated.find(n => n.public_key === target.id);
125
+ const gotControl = nodeUpdated.find(n => n.public_key === control.id);
133
126
 
134
- const expectedTarget = {
135
- alias: target.id.substring(0, 20),
136
- color: '#3399ff',
137
- public_key: target.id,
138
- sockets: gotTarget.sockets,
139
- };
127
+ const expectedControl = {
128
+ alias: control.id.substring(0, 20),
129
+ color: '#3399ff',
130
+ public_key: control.id,
131
+ sockets: gotControl.sockets,
132
+ };
140
133
 
141
- equal(!!gotControl.features, true, 'Got control features');
142
- equal(!!gotControl.updated_at, true, 'Got control updated at');
134
+ const gotTarget = nodeUpdated.find(n => n.public_key === target.id);
143
135
 
144
- delete gotControl.features;
145
- delete gotControl.updated_at;
136
+ const expectedTarget = {
137
+ alias: target.id.substring(0, 20),
138
+ color: '#3399ff',
139
+ public_key: target.id,
140
+ sockets: gotTarget.sockets,
141
+ };
146
142
 
147
- delete gotTarget.features;
148
- delete gotTarget.updated_at;
143
+ equal(!!gotControl.features, true, 'Got control features');
144
+ equal(!!gotControl.updated_at, true, 'Got control updated at');
149
145
 
150
- equal(!!gotTarget, true, 'Got target updated at');
146
+ delete gotControl.features;
147
+ delete gotControl.updated_at;
151
148
 
152
- strictSame(gotControl, expectedControl, 'Got control node announcement');
153
- strictSame(gotTarget, expectedTarget, 'Got target node announcement');
149
+ delete gotTarget.features;
150
+ delete gotTarget.updated_at;
154
151
 
155
- await kill({});
152
+ equal(!!gotTarget, true, 'Got target updated at');
156
153
 
157
- return;
154
+ strictSame(gotControl, expectedControl, 'Got control node announcement');
155
+ strictSame(gotTarget, expectedTarget, 'Got target node announcement');
156
+
157
+ await kill({});
158
+ } catch (err) {
159
+ await kill({});
160
+
161
+ throw err;
162
+ }
163
+ });
158
164
  });
@@ -22,7 +22,7 @@ const capacity = 1e6;
22
22
  const interval = 10;
23
23
  const maturity = 100;
24
24
  const size = 2;
25
- const times = 2000;
25
+ const times = 4000;
26
26
 
27
27
  // Opening unconfirmed channels should in immediate channel opening
28
28
  test(`Open unconfirmed channels`, async ({end, equal, match, strictSame}) => {
@@ -222,19 +222,9 @@ test(`Open unconfirmed channels`, async ({end, equal, match, strictSame}) => {
222
222
  throw new Error('ExpectedClosedChannel');
223
223
  }
224
224
 
225
- if (!confirmed.other_ids.length) {
226
- throw new Error('ExpectedChangeToRealPrivateChannelId');
227
- }
228
-
229
225
  return confirmed;
230
226
  });
231
227
 
232
- equal(privateConfirmed.other_ids.length, 1, 'Got private ephemeral ids');
233
-
234
- const [privateOtherId] = privateConfirmed.other_ids;
235
-
236
- match(privateOtherId, /16000000x0/, 'Got private id');
237
-
238
228
  const [closedChannel] = (await getClosedChannels({lnd})).channels;
239
229
 
240
230
  equal(closedChannel.id, confirmed.id, 'Closed channel shows confirmed id');
@@ -10,6 +10,7 @@ const {cancelHodlInvoice} = require('./../../');
10
10
  const {createHodlInvoice} = require('./../../');
11
11
  const {getInvoice} = require('./../../');
12
12
  const {getInvoices} = require('./../../');
13
+ const {getPayment} = require('./../../');
13
14
  const {pay} = require('./../../');
14
15
  const {subscribeToInvoice} = require('./../../');
15
16
 
@@ -46,6 +47,10 @@ test(`Cancel back a hodl invoice`, async ({end, equal}) => {
46
47
  equal(invoice.is_confirmed, false, 'HTLC has not yet been settled');
47
48
  equal(invoice.is_held, true, 'HTLC is locked in place');
48
49
 
50
+ const payment = await getPayment({lnd, id: invoice.id});
51
+
52
+ equal(payment.is_pending, true, 'payment is pending');
53
+
49
54
  await cancelHodlInvoice({id, lnd: target.lnd});
50
55
  });
51
56
 
@@ -91,6 +91,9 @@ test(`Get sweep transactions`, async ({end, equal}) => {
91
91
  if (sweepTokens === 890455) {
92
92
  equal(anchorTokens, 149, 'Sweep has tokens amount');
93
93
  equal(sweepTokens, 890455, 'Sweep has tokens amount');
94
+ } else if (anchorTokens === 147) {
95
+ equal(anchorTokens, 147, 'Sweep has tokens amount');
96
+ equal(sweepTokens, 889855, 'Sweep has tokens amount');
94
97
  } else {
95
98
  equal(anchorTokens, 136, 'Sweep has tokens amount');
96
99
  equal(sweepTokens, 889855, 'Sweep has tokens amount');