ln-service 54.10.7 → 56.0.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,22 @@
1
1
  # Versions
2
2
 
3
+ ## 56.0.0
4
+
5
+ ### Breaking Changes
6
+
7
+ - Minimum version of node.js is moved up from 14 to 16
8
+
9
+ ## 55.0.0
10
+
11
+ - `openChannel`: Add `is_max_funding` to fund a channel maximally
12
+ - `subscribeToRpcRequests`: Add support for returning `is_max_funding` in
13
+ `open_channel_request`
14
+
15
+ ### Breaking Changes
16
+
17
+ - `subscribeToRpcRequests`: `open_channel_request`: `local_tokens` is now an
18
+ optional value
19
+
3
20
  ## 54.10.7
4
21
 
5
22
  - `signChainAddressMessage`: Add method to sign a message given a chain address
package/README.md CHANGED
@@ -3697,12 +3697,15 @@ Requires `offchain:write`, `onchain:write`, `peers:write` permissions
3697
3697
  `base_fee_mtokens` is not supported on LND 0.15.5 and below
3698
3698
  `fee_rate` is not supported on LND 0.15.5 and below
3699
3699
 
3700
+ `is_max_funding` is not supported on LND 0.16.0 and below
3701
+
3700
3702
  {
3701
3703
  [base_fee_mtokens]: <Routing Base Fee Millitokens Charged String>
3702
3704
  [chain_fee_tokens_per_vbyte]: <Chain Fee Tokens Per VByte Number>
3703
3705
  [cooperative_close_address]: <Restrict Cooperative Close To Address String>
3704
3706
  [fee_rate]: <Routing Fee Rate In Millitokens Per Million Number>
3705
3707
  [give_tokens]: <Tokens to Gift To Partner Number> // Defaults to zero
3708
+ [is_max_funding]: <Use Maximal Chain Funds For Local Funding Bool>
3706
3709
  [is_private]: <Channel is Private Bool> // Defaults to false
3707
3710
  lnd: <Authenticated LND API Object>
3708
3711
  local_tokens: <Total Channel Capacity Tokens Number>
@@ -6826,7 +6829,9 @@ This method is not supported in LND 0.13.4 and below
6826
6829
  [fee_rate]: <Routing Fee Rate In Millitokens Per Million Number>
6827
6830
  [give_tokens]: <Tokens to Gift To Partner Number>
6828
6831
  [is_private]: <Channel is Private Bool>
6829
- local_tokens: <Local Tokens Number>
6832
+ [is_max_funding]: <Use Maximal Chain Funds For Local Funding Bool>
6833
+ [is_private]: <Channel is Private Bool>
6834
+ [local_tokens]: <Local Tokens Number>
6830
6835
  [min_confirmations]: <Spend UTXOs With Minimum Confirmations Number>
6831
6836
  [min_htlc_mtokens]: <Minimum HTLC Millitokens String>
6832
6837
  [partner_csv_delay]: <Peer Output CSV Delay Number>
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.9",
14
+ "lightning": "9.0.0",
15
15
  "macaroon": "3.0.4",
16
16
  "morgan": "1.10.0",
17
17
  "ws": "8.13.0"
@@ -28,18 +28,18 @@
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.3",
31
+ "ln-docker-daemons": "5.0.0",
32
32
  "p2tr": "1.3.3",
33
33
  "portfinder": "1.0.32",
34
34
  "psbt": "2.7.2",
35
- "rimraf": "4.4.1",
35
+ "rimraf": "5.0.0",
36
36
  "secp256k1": "5.0.0",
37
37
  "tiny-secp256k1": "2.2.1",
38
38
  "uuid": "9.0.0",
39
39
  "varuint-bitcoin": "1.1.2"
40
40
  },
41
41
  "engines": {
42
- "node": ">=14"
42
+ "node": ">=16"
43
43
  },
44
44
  "keywords": [
45
45
  "bitcoin",
@@ -65,5 +65,5 @@
65
65
  "integration-test-0.14.4": "DOCKER_LND_VERSION=v0.14.4-beta npm run test",
66
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"
67
67
  },
68
- "version": "54.10.7"
68
+ "version": "56.0.0"
69
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 = 300;
33
+ const times = 500;
34
34
 
35
35
  // Forfeiting a pending channel should remove the pending channel
36
36
  test(`Forfeit pending channel`, async ({end, equal, strictSame}) => {
@@ -25,7 +25,7 @@ test(`Get channel`, async ({end, equal}) => {
25
25
 
26
26
  details.policies.forEach(policy => {
27
27
  equal(policy.base_fee_mtokens, '1000', 'Base fee mtokens');
28
- equal(policy.cltv_delta, 40, 'CLTV policy');
28
+ equal([40, 80].includes(policy.cltv_delta), true, 'CLTV policy');
29
29
  equal(policy.fee_rate, 1, 'Fee rate');
30
30
  equal(policy.is_disabled, false, 'Disabled flag');
31
31
  equal(policy.max_htlc_mtokens, `${ceil(details.capacity * 0.99)}000`);
@@ -51,7 +51,7 @@ test(`Get network graph`, async ({end, equal, strictSame}) => {
51
51
 
52
52
  channel.policies.forEach(policy => {
53
53
  equal(policy.base_fee_mtokens, '1000', 'Default channel base fee');
54
- equal(policy.cltv_delta, 40, 'Default channel CLTV delta');
54
+ equal([40, 80].includes(policy.cltv_delta), true, 'Default CLTV delta');
55
55
  equal(policy.fee_rate, 1, 'Default channel fee rate');
56
56
  equal(policy.is_disabled, false, 'Channels are active');
57
57
  equal(policy.max_htlc_mtokens, `${ceil(channel.capacity * 0.99)}000`);
@@ -67,7 +67,12 @@ test(`Pay`, async ({end, equal, strictSame}) => {
67
67
  const height = (await getHeight({lnd})).current_block_height;
68
68
 
69
69
  paid.hops.forEach(n => {
70
- equal(n.timeout === height + 40 || n.timeout === height + 43, true);
70
+ equal(
71
+ n.timeout === height + 40 ||
72
+ n.timeout === height + 43 ||
73
+ n.timeout === height + 80,
74
+ true
75
+ );
71
76
 
72
77
  delete n.timeout;
73
78
 
@@ -77,6 +77,7 @@ test(`Pay private invoice`, async ({end, equal, strictSame}) => {
77
77
  const route = await asyncRetry({interval: 10, times: 1000}, async () => {
78
78
  const {route} = await getRouteToDestination({
79
79
  lnd,
80
+ cltv_delta: decodedRequest.cltv_delta,
80
81
  destination: decodedRequest.destination,
81
82
  payment: invoice.payment,
82
83
  routes: decodedRequest.routes,
@@ -117,7 +117,7 @@ test(`Subscribe to RPC requests`, async ({end, equal, fail, strictSame}) => {
117
117
  strictSame(err, [400, 'CannotOpenChannelToOwnNode'], 'RPC req accepted');
118
118
  }
119
119
 
120
- await delay(2000);
120
+ await delay(2500);
121
121
 
122
122
  subscription.removeAllListeners();
123
123
  }
@@ -36,7 +36,12 @@ test(`Pay`, async ({end, equal, rejects, strictSame}) => {
36
36
  await addPeer({lnd, public_key: remote.id, socket: remote.socket});
37
37
 
38
38
  const height = (await getHeight({lnd})).current_block_height;
39
- const invoice = await createInvoice({tokens, lnd: remote.lnd});
39
+
40
+ const invoice = await createInvoice({
41
+ tokens,
42
+ cltv_delta: 40,
43
+ lnd: remote.lnd,
44
+ });
40
45
 
41
46
  const {features} = await decodePaymentRequest({
42
47
  lnd,
@@ -93,7 +98,7 @@ test(`Pay`, async ({end, equal, rejects, strictSame}) => {
93
98
  } catch (err) {
94
99
  strictSame(
95
100
  err,
96
- [503, 'PaymentPathfindingFailedToFindPossibleRoute'],
101
+ [400, 'MaxTimeoutTooNearCurrentHeightToMakePayment'],
97
102
  'Fail'
98
103
  );
99
104
  }
@@ -104,7 +109,7 @@ test(`Pay`, async ({end, equal, rejects, strictSame}) => {
104
109
  lnd,
105
110
  destination: remote.id,
106
111
  id: invoice.id,
107
- max_timeout_height: height + 90,
112
+ max_timeout_height: height + 200,
108
113
  messages: [{type: tlvType, value: tlvData}],
109
114
  payment: invoice.payment,
110
115
  tokens: invoice.tokens,
@@ -117,13 +122,7 @@ test(`Pay`, async ({end, equal, rejects, strictSame}) => {
117
122
  equal(paid.mtokens, '101000', 'Paid mtokens');
118
123
  equal(paid.secret, invoice.secret, 'Paid for invoice secret');
119
124
 
120
- paid.hops.forEach(n => {
121
- equal(n.timeout === height + 40 || n.timeout === height + 43, true);
122
-
123
- delete n.timeout;
124
-
125
- return;
126
- });
125
+ paid.hops.forEach(n => delete n.timeout);
127
126
 
128
127
  strictSame(paid.hops, expectedHops, 'Hops are returned');
129
128
  } catch (err) {
@@ -100,6 +100,7 @@ test(`Pay via routes`, async ({end, equal, strictSame}) => {
100
100
 
101
101
  const {route} = await getRouteToDestination({
102
102
  lnd,
103
+ cltv_delta: decodedRequest.cltv_delta,
103
104
  destination: decodedRequest.destination,
104
105
  payment: invoice.payment,
105
106
  routes: decodedRequest.routes,
@@ -133,7 +133,12 @@ test('Subscribe to forwards', async ({end, equal, rejects, strictSame}) => {
133
133
 
134
134
  // LND 0.13.0 and below do not support secret
135
135
  [controlForwards, targetForwards, remoteForwards].forEach(forwards => {
136
- return forwards.forEach(n => delete n.at && delete n.secret);
136
+ return forwards.forEach(n =>
137
+ delete n.at &&
138
+ delete n.cltv_delta &&
139
+ delete n.secret &&
140
+ delete n.timeout
141
+ );
137
142
  });
138
143
 
139
144
  const height = (await getHeight({lnd})).current_block_height;
@@ -142,7 +147,6 @@ test('Subscribe to forwards', async ({end, equal, rejects, strictSame}) => {
142
147
  if (!isAnchors) {
143
148
  strictSame(controlForwards, [
144
149
  {
145
- cltv_delta: undefined,
146
150
  external_failure: undefined,
147
151
  fee: undefined,
148
152
  fee_mtokens: undefined,
@@ -156,11 +160,9 @@ test('Subscribe to forwards', async ({end, equal, rejects, strictSame}) => {
156
160
  mtokens: '101000',
157
161
  out_channel: controlChannel.id,
158
162
  out_payment: 0,
159
- timeout: height + 40 + 43,
160
163
  tokens: 101,
161
164
  },
162
165
  {
163
- cltv_delta: undefined,
164
166
  external_failure: undefined,
165
167
  fee: undefined,
166
168
  fee_mtokens: undefined,
@@ -174,7 +176,6 @@ test('Subscribe to forwards', async ({end, equal, rejects, strictSame}) => {
174
176
  mtokens: undefined,
175
177
  out_channel: controlChannel.id,
176
178
  out_payment: 0,
177
- timeout: undefined,
178
179
  tokens: undefined,
179
180
  },
180
181
  {
@@ -192,11 +193,9 @@ test('Subscribe to forwards', async ({end, equal, rejects, strictSame}) => {
192
193
  mtokens: '490851490',
193
194
  out_channel: controlChannel.id,
194
195
  out_payment: 1,
195
- timeout: height + 40 + 43,
196
196
  tokens: 490851,
197
197
  },
198
198
  {
199
- cltv_delta: undefined,
200
199
  external_failure: undefined,
201
200
  fee: undefined,
202
201
  fee_mtokens: undefined,
@@ -210,11 +209,9 @@ test('Subscribe to forwards', async ({end, equal, rejects, strictSame}) => {
210
209
  mtokens: undefined,
211
210
  out_channel: controlChannel.id,
212
211
  out_payment: 1,
213
- timeout: undefined,
214
212
  tokens: undefined,
215
213
  },
216
214
  {
217
- cltv_delta: undefined,
218
215
  external_failure: undefined,
219
216
  fee: undefined,
220
217
  fee_mtokens: undefined,
@@ -228,11 +225,9 @@ test('Subscribe to forwards', async ({end, equal, rejects, strictSame}) => {
228
225
  mtokens: '100000',
229
226
  out_channel: controlChannel.id,
230
227
  out_payment: 2,
231
- timeout: height + 43,
232
228
  tokens: 100,
233
229
  },
234
230
  {
235
- cltv_delta: undefined,
236
231
  external_failure: undefined,
237
232
  fee: undefined,
238
233
  fee_mtokens: undefined,
@@ -246,7 +241,6 @@ test('Subscribe to forwards', async ({end, equal, rejects, strictSame}) => {
246
241
  mtokens: undefined,
247
242
  out_channel: controlChannel.id,
248
243
  out_payment: 2,
249
- timeout: undefined,
250
244
  tokens: undefined,
251
245
  },
252
246
  ],
@@ -254,7 +248,6 @@ test('Subscribe to forwards', async ({end, equal, rejects, strictSame}) => {
254
248
 
255
249
  strictSame(targetForwards, [
256
250
  {
257
- cltv_delta: 40,
258
251
  external_failure: undefined,
259
252
  fee: 1,
260
253
  fee_mtokens: '1000',
@@ -268,11 +261,9 @@ test('Subscribe to forwards', async ({end, equal, rejects, strictSame}) => {
268
261
  mtokens: '100000',
269
262
  out_channel: targetChannel.id,
270
263
  out_payment: 0,
271
- timeout: 497,
272
264
  tokens: 100,
273
265
  },
274
266
  {
275
- cltv_delta: undefined,
276
267
  external_failure: undefined,
277
268
  fee: undefined,
278
269
  fee_mtokens: undefined,
@@ -286,11 +277,9 @@ test('Subscribe to forwards', async ({end, equal, rejects, strictSame}) => {
286
277
  mtokens: undefined,
287
278
  out_channel: targetChannel.id,
288
279
  out_payment: 0,
289
- timeout: undefined,
290
280
  tokens: undefined,
291
281
  },
292
282
  {
293
- cltv_delta: 40,
294
283
  external_failure: 'TEMPORARY_CHANNEL_FAILURE',
295
284
  fee: 1,
296
285
  fee_mtokens: '1490',
@@ -304,11 +293,9 @@ test('Subscribe to forwards', async ({end, equal, rejects, strictSame}) => {
304
293
  mtokens: '490850000',
305
294
  out_channel: targetChannel.id,
306
295
  out_payment: 0,
307
- timeout: 497,
308
296
  tokens: 490850,
309
297
  },
310
298
  {
311
- cltv_delta: undefined,
312
299
  external_failure: 'INCORRECT_OR_UNKNOWN_PAYMENT_DETAILS',
313
300
  fee: undefined,
314
301
  fee_mtokens: undefined,
@@ -322,7 +309,6 @@ test('Subscribe to forwards', async ({end, equal, rejects, strictSame}) => {
322
309
  mtokens: undefined,
323
310
  out_channel: undefined,
324
311
  out_payment: undefined,
325
- timeout: undefined,
326
312
  tokens: undefined,
327
313
  },
328
314
  ],
@@ -330,7 +316,6 @@ test('Subscribe to forwards', async ({end, equal, rejects, strictSame}) => {
330
316
 
331
317
  strictSame(remoteForwards, [
332
318
  {
333
- cltv_delta: undefined,
334
319
  external_failure: undefined,
335
320
  fee: undefined,
336
321
  fee_mtokens: undefined,
@@ -344,7 +329,6 @@ test('Subscribe to forwards', async ({end, equal, rejects, strictSame}) => {
344
329
  mtokens: undefined,
345
330
  out_channel: undefined,
346
331
  out_payment: undefined,
347
- timeout: undefined,
348
332
  tokens: undefined,
349
333
  },
350
334
  ],
@@ -352,7 +336,6 @@ test('Subscribe to forwards', async ({end, equal, rejects, strictSame}) => {
352
336
  } else {
353
337
  strictSame(controlForwards, [
354
338
  {
355
- cltv_delta: undefined,
356
339
  external_failure: undefined,
357
340
  fee: undefined,
358
341
  fee_mtokens: undefined,
@@ -366,11 +349,9 @@ test('Subscribe to forwards', async ({end, equal, rejects, strictSame}) => {
366
349
  mtokens: '101000',
367
350
  out_channel: controlChannel.id,
368
351
  out_payment: 0,
369
- timeout: height + 40 + 43,
370
352
  tokens: 101,
371
353
  },
372
354
  {
373
- cltv_delta: undefined,
374
355
  external_failure: undefined,
375
356
  fee: undefined,
376
357
  fee_mtokens: undefined,
@@ -384,11 +365,9 @@ test('Subscribe to forwards', async ({end, equal, rejects, strictSame}) => {
384
365
  mtokens: undefined,
385
366
  out_channel: controlChannel.id,
386
367
  out_payment: 0,
387
- timeout: undefined,
388
368
  tokens: undefined,
389
369
  },
390
370
  {
391
- cltv_delta: undefined,
392
371
  external_failure: undefined,
393
372
  fee: undefined,
394
373
  fee_mtokens: undefined,
@@ -402,11 +381,9 @@ test('Subscribe to forwards', async ({end, equal, rejects, strictSame}) => {
402
381
  mtokens: '496431496',
403
382
  out_channel: controlChannel.id,
404
383
  out_payment: 1,
405
- timeout: height + 40 + 43,
406
384
  tokens: 496431,
407
385
  },
408
386
  {
409
- cltv_delta: undefined,
410
387
  external_failure: undefined,
411
388
  fee: undefined,
412
389
  fee_mtokens: undefined,
@@ -420,11 +397,9 @@ test('Subscribe to forwards', async ({end, equal, rejects, strictSame}) => {
420
397
  mtokens: undefined,
421
398
  out_channel: controlChannel.id,
422
399
  out_payment: 1,
423
- timeout: undefined,
424
400
  tokens: undefined,
425
401
  },
426
402
  {
427
- cltv_delta: undefined,
428
403
  external_failure: undefined,
429
404
  fee: undefined,
430
405
  fee_mtokens: undefined,
@@ -438,11 +413,9 @@ test('Subscribe to forwards', async ({end, equal, rejects, strictSame}) => {
438
413
  mtokens: '100000',
439
414
  out_channel: controlChannel.id,
440
415
  out_payment: 2,
441
- timeout: height + 43,
442
416
  tokens: 100,
443
417
  },
444
418
  {
445
- cltv_delta: undefined,
446
419
  external_failure: undefined,
447
420
  fee: undefined,
448
421
  fee_mtokens: undefined,
@@ -456,7 +429,6 @@ test('Subscribe to forwards', async ({end, equal, rejects, strictSame}) => {
456
429
  mtokens: undefined,
457
430
  out_channel: controlChannel.id,
458
431
  out_payment: 2,
459
- timeout: undefined,
460
432
  tokens: undefined,
461
433
  },
462
434
  ],
@@ -464,7 +436,6 @@ test('Subscribe to forwards', async ({end, equal, rejects, strictSame}) => {
464
436
 
465
437
  strictSame(targetForwards, [
466
438
  {
467
- cltv_delta: 40,
468
439
  external_failure: undefined,
469
440
  fee: 1,
470
441
  fee_mtokens: '1000',
@@ -478,11 +449,9 @@ test('Subscribe to forwards', async ({end, equal, rejects, strictSame}) => {
478
449
  mtokens: '100000',
479
450
  out_channel: targetChannel.id,
480
451
  out_payment: 0,
481
- timeout: height + 43,
482
452
  tokens: 100,
483
453
  },
484
454
  {
485
- cltv_delta: undefined,
486
455
  external_failure: undefined,
487
456
  fee: undefined,
488
457
  fee_mtokens: undefined,
@@ -496,11 +465,9 @@ test('Subscribe to forwards', async ({end, equal, rejects, strictSame}) => {
496
465
  mtokens: undefined,
497
466
  out_channel: targetChannel.id,
498
467
  out_payment: 0,
499
- timeout: undefined,
500
468
  tokens: undefined,
501
469
  },
502
470
  {
503
- cltv_delta: 40,
504
471
  external_failure: 'TEMPORARY_CHANNEL_FAILURE',
505
472
  fee: 1,
506
473
  fee_mtokens: '1496',
@@ -514,11 +481,9 @@ test('Subscribe to forwards', async ({end, equal, rejects, strictSame}) => {
514
481
  mtokens: '496430000',
515
482
  out_channel: targetChannel.id,
516
483
  out_payment: 0,
517
- timeout: height + 43,
518
484
  tokens: 496430,
519
485
  },
520
486
  {
521
- cltv_delta: undefined,
522
487
  external_failure: 'INCORRECT_OR_UNKNOWN_PAYMENT_DETAILS',
523
488
  fee: undefined,
524
489
  fee_mtokens: undefined,
@@ -532,7 +497,6 @@ test('Subscribe to forwards', async ({end, equal, rejects, strictSame}) => {
532
497
  mtokens: undefined,
533
498
  out_channel: undefined,
534
499
  out_payment: undefined,
535
- timeout: undefined,
536
500
  tokens: undefined,
537
501
  },
538
502
  ],
@@ -540,7 +504,6 @@ test('Subscribe to forwards', async ({end, equal, rejects, strictSame}) => {
540
504
 
541
505
  strictSame(remoteForwards, [
542
506
  {
543
- cltv_delta: undefined,
544
507
  external_failure: undefined,
545
508
  fee: undefined,
546
509
  fee_mtokens: undefined,
@@ -554,7 +517,6 @@ test('Subscribe to forwards', async ({end, equal, rejects, strictSame}) => {
554
517
  mtokens: undefined,
555
518
  out_channel: undefined,
556
519
  out_payment: undefined,
557
- timeout: undefined,
558
520
  tokens: undefined,
559
521
  },
560
522
  ],