ln-service 54.3.2 → 54.4.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.
Files changed (28) hide show
  1. package/CHANGELOG.md +9 -0
  2. package/README.md +10 -8
  3. package/package.json +5 -4
  4. package/test/chainrpc-integration/test_subscribe_to_blocks.js +6 -2
  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/integration/test_get_chain_fee_estimate.js +8 -2
  14. package/test/integration/test_get_forwards.js +3 -1
  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_recover_funds_from_channel.js +3 -0
  19. package/test/integration/test_recover_funds_from_channels.js +3 -0
  20. package/test/integration/test_send_to_chain_addresses.js +2 -1
  21. package/test/integration/test_subscribe_to_rpc_requests.js +2 -0
  22. package/test/integration/test_subscribe_to_transactions.js +9 -2
  23. package/test/integration/test_trusted_funding.js +9 -7
  24. package/test/macros/change_password.js +3 -3
  25. package/test/macros/spawn_lnd.js +3 -3
  26. package/test/routerrpc-integration/test_subscribe_to_payments.js +1 -1
  27. package/test/tower_serverrpc-integration/test_get_tower_server_info.js +6 -9
  28. package/test/walletrpc-integration/test_fund_psbt.js +8 -2
package/CHANGELOG.md CHANGED
@@ -1,5 +1,14 @@
1
1
  # Versions
2
2
 
3
+ ## 54.4.0
4
+
5
+ - `subscribeToRpcRequests`: `open_channel_request` add support for
6
+ `fee_rate`, `base_fee_mtokens`
7
+
8
+ ## 54.3.3
9
+
10
+ - `getWalletInfo`: Add support for LND 0.15.5
11
+
3
12
  ## 54.3.2
4
13
 
5
14
  - `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>
@@ -6704,8 +6704,10 @@ This method is not supported in LND 0.13.4 and below
6704
6704
  macaroon: <Base64 Encoded Macaroon String>
6705
6705
  reject: ({message: <Rejection String>}, [cbk]) => {}
6706
6706
  request: {
6707
+ [base_fee_mtokens]: <Routing Base Fee Millitokens Charged String>
6707
6708
  [chain_fee_tokens_per_vbyte]: <Chain Fee Tokens Per VByte Number>
6708
6709
  [cooperative_close_address]: <Prefer Cooperative Close To Address String>
6710
+ [fee_rate]: <Routing Fee Rate In Millitokens Per Million Number>
6709
6711
  [give_tokens]: <Tokens to Gift To Partner Number>
6710
6712
  [is_private]: <Channel is Private Bool>
6711
6713
  local_tokens: <Local Tokens 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.2",
14
- "lightning": "6.3.1",
14
+ "lightning": "6.4.0",
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": "4.0.0",
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/tower_serverrpc-integration/*.js test/walletrpc-integration/*.js"
65
66
  },
66
- "version": "54.3.2"
67
+ "version": "54.4.0"
67
68
  }
@@ -14,7 +14,7 @@ const {subscribeToBlocks} = require('./../../');
14
14
  const {waitForTermination} = require('./../macros');
15
15
 
16
16
  const confirmationCount = 6;
17
- const interval = 10;
17
+ const interval = 50;
18
18
  const race = promises => Promise.race(promises);
19
19
  const times = 4000;
20
20
 
@@ -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({});
@@ -9,8 +9,10 @@ const {getForwards} = require('./../../');
9
9
  const {pay} = require('./../../');
10
10
  const {setupChannel} = require('./../macros');
11
11
 
12
+ const interval = 100;
12
13
  const limit = 1;
13
14
  const size = 3;
15
+ const times = 1000;
14
16
  const tokens = 100;
15
17
 
16
18
  // Getting forwarded payments should return all forwarded payments
@@ -32,7 +34,7 @@ test('Get forwards', async ({end, equal, strictSame}) => {
32
34
  await delay(2000);
33
35
 
34
36
  for (let i = 0, l = remote.lnd; i < 3; i++) {
35
- await asyncRetry({}, async () => {
37
+ await asyncRetry({interval, times}, async () => {
36
38
  await delay(1000);
37
39
 
38
40
  await pay({
@@ -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
  }
@@ -34,6 +34,7 @@ test(`Recover funds from channel`, async ({end, equal}) => {
34
34
  generate_address: generateAddress,
35
35
  lightning_p2p_port: await getPort({port: 12001, stopPort: 13000}),
36
36
  lightning_rpc_port: await getPort({port: 13001, stopPort: 14000}),
37
+ lightning_tower_port: await getPort({port: 14001, stopPort: 15000}),
37
38
  });
38
39
  });
39
40
 
@@ -46,6 +47,7 @@ test(`Recover funds from channel`, async ({end, equal}) => {
46
47
  generate_address: generateAddress,
47
48
  lightning_p2p_port: await getPort({port: 12001, stopPort: 13000}),
48
49
  lightning_rpc_port: await getPort({port: 13001, stopPort: 14000}),
50
+ lightning_tower_port: await getPort({port: 14001, stopPort: 15000}),
49
51
  });
50
52
  });
51
53
 
@@ -116,6 +118,7 @@ test(`Recover funds from channel`, async ({end, equal}) => {
116
118
  generate_address: generateAddress,
117
119
  lightning_p2p_port: await getPort({port: 12001, stopPort: 13000}),
118
120
  lightning_rpc_port: await getPort({port: 13001, stopPort: 14000}),
121
+ lightning_tower_port: await getPort({port: 14001, stopPort: 15000}),
119
122
  });
120
123
  });
121
124
 
@@ -34,6 +34,7 @@ test(`Recover funds from channels`, async ({end, equal}) => {
34
34
  generate_address: generateAddress,
35
35
  lightning_p2p_port: await getPort({port: 12001, stopPort: 13000}),
36
36
  lightning_rpc_port: await getPort({port: 13001, stopPort: 14000}),
37
+ lightning_tower_port: await getPort({port: 14001, stopPort: 15000}),
37
38
  });
38
39
  });
39
40
 
@@ -46,6 +47,7 @@ test(`Recover funds from channels`, async ({end, equal}) => {
46
47
  generate_address: generateAddress,
47
48
  lightning_p2p_port: await getPort({port: 12001, stopPort: 13000}),
48
49
  lightning_rpc_port: await getPort({port: 13001, stopPort: 14000}),
50
+ lightning_tower_port: await getPort({port: 14001, stopPort: 15000}),
49
51
  });
50
52
  });
51
53
 
@@ -112,6 +114,7 @@ test(`Recover funds from channels`, async ({end, equal}) => {
112
114
  generate_address: generateAddress,
113
115
  lightning_p2p_port: await getPort({port: 12001, stopPort: 13000}),
114
116
  lightning_rpc_port: await getPort({port: 13001, stopPort: 14000}),
117
+ lightning_tower_port: await getPort({port: 14001, stopPort: 15000}),
115
118
  });
116
119
  });
117
120
 
@@ -6,6 +6,7 @@ const {createChainAddress} = require('./../../');
6
6
  const {getChainBalance} = require('./../../');
7
7
  const {sendToChainAddresses} = require('./../../');
8
8
 
9
+ const interval = 1000;
9
10
  const regtestBech32AddressHrp = 'bcrt';
10
11
  const size = 2;
11
12
  const times = 10;
@@ -47,7 +48,7 @@ test(`Send to chain address`, async ({end, equal}) => {
47
48
  equal(sent.is_outgoing, true, 'Transaction is outgoing');
48
49
  equal(sent.tokens, tokens, 'Tokens amount matches tokens sent');
49
50
 
50
- await asyncRetry({times}, async () => {
51
+ await asyncRetry({interval, times}, async () => {
51
52
  // Generate to confirm the tx
52
53
  await control.generate({});
53
54
 
@@ -143,6 +143,8 @@ test(`Subscribe to RPC requests`, async ({end, equal, fail, strictSame}) => {
143
143
  // Gift some tokens in a channel
144
144
  await openChannel({
145
145
  lnd,
146
+ base_fee_mtokens: '1',
147
+ fee_rate: 1,
146
148
  give_tokens: 1e5,
147
149
  local_tokens: 1e6,
148
150
  partner_public_key: Buffer.alloc(33, 2).toString('hex'),
@@ -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');
@@ -85,13 +85,15 @@ test(`Open unconfirmed channels`, async ({end, equal, match, strictSame}) => {
85
85
  });
86
86
 
87
87
  // Propose the channel to the peer
88
- const {pending} = await openChannels({
89
- lnd,
90
- channels: [{
91
- capacity,
92
- is_trusted_funding: true,
93
- partner_public_key: target.id,
94
- }],
88
+ const {pending} = await asyncRetry({interval, times}, async () => {
89
+ return await openChannels({
90
+ lnd,
91
+ channels: [{
92
+ capacity,
93
+ is_trusted_funding: true,
94
+ partner_public_key: target.id,
95
+ }],
96
+ });
95
97
  });
96
98
 
97
99
  // Setup funding to the 2:2 output
@@ -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
  }
@@ -1,16 +1,15 @@
1
+ const {spawnLightningCluster} = require('ln-docker-daemons');
1
2
  const {test} = require('@alexbosworth/tap');
2
3
 
3
4
  const {getTowerServerInfo} = require('./../../');
4
- const {spawnLnd} = require('./../macros');
5
- const {waitForTermination} = require('./../macros');
6
5
 
7
- const pubKeyHexLength = Buffer.alloc(33).toString('hex').length;
6
+ const conf = ['--watchtower.active'];
8
7
 
9
8
  // Getting the tower server info should return tower server info
10
9
  test(`Get tower server info`, async ({end, equal, match}) => {
11
- const spawned = await spawnLnd({tower: true});
10
+ const {kill, nodes} = await spawnLightningCluster({lnd_configuration: conf});
12
11
 
13
- const {lnd} = spawned;
12
+ const [{lnd}] = nodes;
14
13
 
15
14
  const {tower} = await getTowerServerInfo({lnd});
16
15
 
@@ -20,15 +19,13 @@ test(`Get tower server info`, async ({end, equal, match}) => {
20
19
 
21
20
  match(socket, /127.0.0.1\:\d\d\d\d/, 'Tower socket returned');
22
21
 
23
- equal(tower.public_key.length, pubKeyHexLength, 'Public key returned');
22
+ equal(tower.public_key.length, 66, 'Public key returned');
24
23
 
25
24
  const [uri] = tower.uris;
26
25
 
27
26
  equal(uri, `${tower.public_key}@${socket}`, 'Got back socket');
28
27
 
29
- spawned.kill();
30
-
31
- await waitForTermination({lnd});
28
+ await kill({});
32
29
 
33
30
  return end();
34
31
  });
@@ -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