ln-service 54.3.2 → 54.3.3

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.
Files changed (22) hide show
  1. package/CHANGELOG.md +4 -0
  2. package/README.md +8 -8
  3. package/package.json +5 -4
  4. package/test/chainrpc-integration/test_subscribe_to_blocks.js +5 -1
  5. package/test/chainrpc-integration/test_subscribe_to_chain_spend.js +2 -2
  6. package/test/{integration → extra-integration}/test_change_password.js +0 -0
  7. package/test/{integration → extra-integration}/test_get_wallet_status.js +0 -0
  8. package/test/{integration → extra-integration}/test_no_macaroon.js +0 -0
  9. package/test/{tower_clientrpc-integration → extra-integration/tower_clientrpc-integration}/test_connect_watchtower.js +0 -0
  10. package/test/{tower_clientrpc-integration → extra-integration/tower_clientrpc-integration}/test_disconnect_watchtower.js +1 -1
  11. package/test/{tower_clientrpc-integration → extra-integration/tower_clientrpc-integration}/test_get_connected_watchtowers.js +0 -0
  12. package/test/{tower_clientrpc-integration → extra-integration/tower_clientrpc-integration}/test_update_connected_watchtower.js +0 -0
  13. package/test/{tower_serverrpc-integration → extra-integration/tower_serverrpc-integration}/test_get_tower_server_info.js +0 -0
  14. package/test/integration/test_get_chain_fee_estimate.js +8 -2
  15. package/test/integration/test_get_settlement_status.js +1 -1
  16. package/test/integration/test_open_channel.js +1 -1
  17. package/test/integration/test_open_channels.js +1 -1
  18. package/test/integration/test_subscribe_to_transactions.js +9 -2
  19. package/test/macros/change_password.js +3 -3
  20. package/test/macros/spawn_lnd.js +3 -3
  21. package/test/routerrpc-integration/test_subscribe_to_payments.js +1 -1
  22. package/test/walletrpc-integration/test_fund_psbt.js +8 -2
package/CHANGELOG.md CHANGED
@@ -1,5 +1,9 @@
1
1
  # Versions
2
2
 
3
+ ## 54.3.3
4
+
5
+ - `getWalletInfo`: Add support for LND 0.15.5
6
+
3
7
  ## 54.3.2
4
8
 
5
9
  - `createUnsignedRequest`: Fix support for empty description requests
package/README.md CHANGED
@@ -9,7 +9,7 @@ through npm.
9
9
 
10
10
  Supported LND versions:
11
11
 
12
- - v0.15.2-beta to v0.15.4-beta
12
+ - v0.15.2-beta to v0.15.5-beta
13
13
  - v0.14.4-beta to v0.14.5-beta
14
14
 
15
15
  For typescript-ready methods, check out https://github.com/alexbosworth/lightning#readme
@@ -3157,7 +3157,7 @@ await payViaRoutes({lnd, routes: [route]});
3157
3157
 
3158
3158
  Get the settlement status of a received HTLC
3159
3159
 
3160
- Note: this method is not supported in LND versions 0.15.4 and below
3160
+ Note: this method is not supported in LND versions 0.15.5 and below
3161
3161
 
3162
3162
  Requires `offchain:read` permissions
3163
3163
 
@@ -3485,7 +3485,7 @@ const request = require('@alexbosworth/request');
3485
3485
  const websocket = require('ws');
3486
3486
  const {Writable} = require('stream');
3487
3487
 
3488
- const log = output => console.log(output);
3488
+ const log = output => log(output);
3489
3489
  const path = '/lnd/';
3490
3490
  const port = 8050;
3491
3491
 
@@ -3606,8 +3606,8 @@ If give_tokens is set, it is a gift and it does not alter the capacity
3606
3606
 
3607
3607
  Requires `offchain:write`, `onchain:write`, `peers:write` permissions
3608
3608
 
3609
- `base_fee_mtokens` is not supported on LND 0.15.4 and below
3610
- `fee_rate` is not supported on LND 0.15.4 and below
3609
+ `base_fee_mtokens` is not supported on LND 0.15.5 and below
3610
+ `fee_rate` is not supported on LND 0.15.5 and below
3611
3611
 
3612
3612
  {
3613
3613
  [base_fee_mtokens]: <Routing Base Fee Millitokens Charged String>
@@ -3659,8 +3659,8 @@ after the funding step.
3659
3659
  `--protocol.option-scid-alias` and `--protocol.zero-conf` set on both sides
3660
3660
  as well as a channel open request listener to accept the trusted funding.
3661
3661
 
3662
- `base_fee_mtokens` is not supported on LND 0.15.4 and below
3663
- `fee_rate` is not supported on LND 0.15.4 and below
3662
+ `base_fee_mtokens` is not supported on LND 0.15.5 and below
3663
+ `fee_rate` is not supported on LND 0.15.5 and below
3664
3664
 
3665
3665
  {
3666
3666
  channels: [{
@@ -6309,7 +6309,7 @@ Subscribe to outgoing payments
6309
6309
 
6310
6310
  Requires `offchain:read` permission
6311
6311
 
6312
- Note: Method not supported on LND 0.15.4 and below
6312
+ Note: Method not supported on LND 0.15.5 and below
6313
6313
 
6314
6314
  {
6315
6315
  lnd: <Authenticated LND API Object>
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.2",
14
- "lightning": "6.3.1",
14
+ "lightning": "6.3.2",
15
15
  "macaroon": "3.0.4",
16
16
  "morgan": "1.10.0",
17
17
  "ws": "8.11.0"
@@ -28,7 +28,7 @@
28
28
  "bn.js": "5.2.1",
29
29
  "bs58check": "2.1.2",
30
30
  "ecpair": "2.1.0",
31
- "ln-docker-daemons": "3.1.5",
31
+ "ln-docker-daemons": "3.1.6",
32
32
  "p2tr": "1.3.2",
33
33
  "portfinder": "1.0.32",
34
34
  "psbt": "2.7.1",
@@ -56,12 +56,13 @@
56
56
  "url": "https://github.com/alexbosworth/ln-service.git"
57
57
  },
58
58
  "scripts": {
59
+ "integration-test-0.15.5": "DOCKER_LND_VERSION=v0.15.5-beta npm run test",
59
60
  "integration-test-0.15.4": "DOCKER_LND_VERSION=v0.15.4-beta npm run test",
60
61
  "integration-test-0.15.3": "DOCKER_LND_VERSION=v0.15.3-beta npm run test",
61
62
  "integration-test-0.15.2": "DOCKER_LND_VERSION=v0.15.2-beta npm run test",
62
63
  "integration-test-0.14.5": "DOCKER_LND_VERSION=v0.14.5-beta npm run test",
63
64
  "integration-test-0.14.4": "DOCKER_LND_VERSION=v0.14.4-beta npm run test",
64
- "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"
65
+ "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/walletrpc-integration/*.js"
65
66
  },
66
- "version": "54.3.2"
67
+ "version": "54.3.3"
67
68
  }
@@ -25,7 +25,7 @@ test(`Subscribe to blocks`, async ({end, equal, fail}) => {
25
25
 
26
26
  const [{generate, lnd}] = nodes;
27
27
 
28
- await asyncRetry({interval, times}, async () => {
28
+ const gotHeight = await asyncRetry({interval, times}, async () => {
29
29
  const subBlocks = subscribeToBlocks({lnd});
30
30
 
31
31
  const [event] = await race([
@@ -36,8 +36,12 @@ test(`Subscribe to blocks`, async ({end, equal, fail}) => {
36
36
  if (!event.height) {
37
37
  throw new Error('ExpectedBlockEvent');
38
38
  }
39
+
40
+ return !!event.height;
39
41
  });
40
42
 
43
+ equal(gotHeight, true, 'Got the block height');
44
+
41
45
  try {
42
46
  // Wait for chainrpc to be active
43
47
  await asyncRetry({interval, times}, async () => {
@@ -62,7 +62,7 @@ test(`Subscribe to chain spend`, async ({end, equal}) => {
62
62
 
63
63
  const {utxos} = await getUtxos({lnd});
64
64
 
65
- const [utxo] = utxos;
65
+ const [utxo] = utxos.filter(n => n.address_format === 'p2wpkh');
66
66
 
67
67
  await control.generate({count});
68
68
 
@@ -79,7 +79,7 @@ test(`Subscribe to chain spend`, async ({end, equal}) => {
79
79
  sub.once('confirmation', ({height, transaction, vin}) => {
80
80
  equal(!!height, true, 'Height of the confirmation is returned');
81
81
  equal(!!transaction, true, 'Raw transaction is returned');
82
- equal(vin, 0, 'Transaction input index is returned');
82
+ equal(vin !== undefined, true, 'Transaction input index is returned');
83
83
 
84
84
  return gotAddressConf = true;
85
85
  });
@@ -38,7 +38,7 @@ test(`Disconnect watchtower`, async ({end, equal, match}) => {
38
38
 
39
39
  const [disconnected] = (await getConnectedWatchtowers({lnd})).towers;
40
40
 
41
- // LND 0.15.4 and below retain the tower
41
+ // LND 0.15.5 and below retain the tower
42
42
  if (!!disconnected) {
43
43
  equal(disconnected.is_active, false, 'Tower is inactive');
44
44
  }
@@ -6,7 +6,7 @@ const {createChainAddress} = require('./../../');
6
6
  const {getChainBalance} = require('./../../');
7
7
  const {getChainFeeEstimate} = require('./../../');
8
8
 
9
- const expectedFee = 8650;
9
+ const expectedFee = 9250;
10
10
  const expectedFeeRate = 50;
11
11
  const format = 'np2wpkh';
12
12
  const size = 2;
@@ -39,7 +39,13 @@ test(`Get chain fee estimate`, async ({end, equal}) => {
39
39
  ],
40
40
  });
41
41
 
42
- equal(estimate.fee, expectedFee, 'Total fee is estimated');
42
+ // LND 0.15.4 and below uses P2WPKH as change
43
+ if (estimate.fee === 8650) {
44
+ equal(estimate.fee, 8650, 'Total fee is estimated');
45
+ } else {
46
+ equal(estimate.fee, expectedFee, 'Total fee is estimated');
47
+ }
48
+
43
49
  equal(estimate.tokens_per_vbyte, expectedFeeRate, 'Fee per vbyte is given');
44
50
 
45
51
  await kill({});
@@ -19,7 +19,7 @@ test(`Get settlement status`, async ({end, equal, strictSame}) => {
19
19
 
20
20
  const [{generate, lnd}, target] = nodes;
21
21
 
22
- // LND 0.15.4 and below do not support settlement status lookups
22
+ // LND 0.15.5 and below do not support settlement status lookups
23
23
  try {
24
24
  await getSettlementStatus({
25
25
  lnd: target.lnd,
@@ -70,7 +70,7 @@ test(`Open channel`, async ({end, equal}) => {
70
70
  throw new Error('ExpectedKnownPolicyBaseFeeMtokens');
71
71
  }
72
72
 
73
- // LND 0.15.4 and below do not support setting fees on open
73
+ // LND 0.15.5 and below do not support setting fees on open
74
74
  if (policy.base_fee_mtokens === defaultBaseFee) {
75
75
  return;
76
76
  }
@@ -139,7 +139,7 @@ test(`Open channels`, async ({end, equal}) => {
139
139
 
140
140
  const policy = policies.find(n => !!n.cltv_delta);
141
141
 
142
- // LND 0.15.4 and below do not support setting fees on open
142
+ // LND 0.15.5 and below do not support setting fees on open
143
143
  if (policy.base_fee_mtokens === defaultBaseFee) {
144
144
  return;
145
145
  }
@@ -63,9 +63,16 @@ test(`Subscribe to chain transactions`, async ({end, equal, fail}) => {
63
63
 
64
64
  equal(!!tx.created_at, true, 'Tx has a creation date');
65
65
  equal(tx.is_outgoing, true, 'Tx is outgoing');
66
- equal(tx.fee, 7050, 'Transaction has a chain fee');
67
66
  equal(!!tx.id, true, 'Tx has an id');
68
- equal(tx.tokens, 1007050, 'Tx tokens is fee + tokens sent');
67
+
68
+ // LND 0.15.4 and below do not use P2TR change addresses
69
+ if (tx.fee === 7050) {
70
+ equal(tx.fee, 7050, 'Transaction has a chain fee');
71
+ equal(tx.tokens, 1007050, 'Tx tokens is fee + tokens sent');
72
+ } else {
73
+ equal(tx.fee, 7650, 'Transaction has a chain fee');
74
+ equal(tx.tokens, 1007650, 'Tx tokens is fee + tokens sent');
75
+ }
69
76
 
70
77
  if (!!tx.output_addresses.find(n => n.length < 14 || n.length > 74)) {
71
78
  fail('Output address lengths must be between 14 and 74');
@@ -33,7 +33,7 @@ const lightningTlsCertFileName = 'tls.cert';
33
33
  const lightningTlsKeyFileName = 'tls.key';
34
34
  const lightningWalletPassword = 'password';
35
35
  const lndWalletUnlockerService = 'WalletUnlocker';
36
- const localhost = 'localhost';
36
+ const localhost = '127.0.0.1';
37
37
  const maxSpawnChainDaemonAttempts = 3;
38
38
  const readMacaroonFileName = 'readonly.macaroon';
39
39
  const retryCreateSeedCount = 500;
@@ -292,7 +292,7 @@ module.exports = ({network}, cbk) => {
292
292
  return cbk(null, {
293
293
  macaroon,
294
294
  cert: readFileSync(certPath).toString('base64'),
295
- host: `${localhost}:${getPorts.rpc}`,
295
+ host: `localhost:${getPorts.rpc}`,
296
296
  });
297
297
  }],
298
298
 
@@ -396,7 +396,7 @@ module.exports = ({network}, cbk) => {
396
396
  try {
397
397
  return cbk(null, unauthenticatedLndGrpc({
398
398
  cert,
399
- socket: `${localhost}:${getPorts.rpc}`,
399
+ socket: `localhost:${getPorts.rpc}`,
400
400
  }).lnd);
401
401
  } catch (err) {
402
402
  return cbk([503, 'FailedToLaunchLightningDaemon', err]);
@@ -34,7 +34,7 @@ const lightningTlsCertFileName = 'tls.cert';
34
34
  const lightningTlsKeyFileName = 'tls.key';
35
35
  const lightningWalletPassword = 'password';
36
36
  const lndWalletUnlockerService = 'Unlocker';
37
- const localhost = 'localhost';
37
+ const localhost = '127.0.0.1';
38
38
  const maxSpawnChainDaemonAttempts = 10;
39
39
  const {random} = Math;
40
40
  const readMacaroonFileName = 'readonly.macaroon';
@@ -327,7 +327,7 @@ module.exports = (args, cbk) => {
327
327
  'spawnLightningDaemon',
328
328
  ({cert, getPorts}, cbk) =>
329
329
  {
330
- const socket = `${localhost}:${getPorts.rpc}`;
330
+ const socket = `localhost:${getPorts.rpc}`;
331
331
 
332
332
  try {
333
333
  return cbk(null, unauthenticatedLndGrpc({cert, socket}).lnd);
@@ -450,7 +450,7 @@ module.exports = (args, cbk) => {
450
450
  return cbk(null, {
451
451
  cert,
452
452
  macaroon,
453
- socket: `${localhost}:${getPorts.rpc}`,
453
+ socket: `localhost:${getPorts.rpc}`,
454
454
  });
455
455
  }],
456
456
 
@@ -43,7 +43,7 @@ test(`Subscribe to payments`, async ({end, rejects, strictSame}) => {
43
43
  sub.on('error', error => {
44
44
  const [,, {err}] = error;
45
45
 
46
- // subscribeToPayments is not supported on LND 0.15.4 and below
46
+ // subscribeToPayments is not supported on LND 0.15.5 and below
47
47
  if (err.details === unsupported) {
48
48
  return isLegacy.push(error);
49
49
  }
@@ -98,8 +98,14 @@ test(`Fund PSBT`, async ({end, equal}) => {
98
98
  const change = funded.outputs.find(n => n.is_change);
99
99
  const output = funded.outputs.find(n => !n.is_change);
100
100
 
101
- equal(change.output_script.length, 44, 'Change address is returned');
102
- equal(change.tokens, 4998992950, 'Got change output value');
101
+ // LND 0.15.4 and below use P2WPKH as change
102
+ if (change.output_script.length === 44) {
103
+ equal(change.output_script.length, 44, 'Change address is returned');
104
+ equal(change.tokens, 4998992950, 'Got change output value');
105
+ } else {
106
+ equal(change.output_script.length, 68, 'Change address is returned');
107
+ equal(change.tokens, 4998992350, 'Got change output value');
108
+ }
103
109
 
104
110
  equal(output.tokens, tokens, 'Got expected tokens output');
105
111