ln-service 57.25.0 → 57.25.1

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,9 @@
1
1
  # Versions
2
2
 
3
+ ## 57.25.1
4
+
5
+ - Add support for LND 0.19.0-beta
6
+
3
7
  ## 57.25.0
4
8
 
5
9
  - Add support for Testnet4
package/README.md CHANGED
@@ -9,6 +9,7 @@ through npm.
9
9
 
10
10
  Supported LND versions:
11
11
 
12
+ - v0.19.0-beta
12
13
  - v0.18.0-beta to v0.18.5-beta
13
14
  - v0.17.0-beta to v0.17.5-beta
14
15
  - v0.16.0-beta to v0.16.4-beta
package/package.json CHANGED
@@ -9,7 +9,7 @@
9
9
  "dependencies": {
10
10
  "bolt07": "1.9.4",
11
11
  "invoices": "4.0.0",
12
- "lightning": "10.25.0",
12
+ "lightning": "10.25.2",
13
13
  "macaroon": "3.0.4"
14
14
  },
15
15
  "description": "Interaction helper for your Lightning Network daemon",
@@ -51,6 +51,7 @@
51
51
  "url": "https://github.com/alexbosworth/ln-service.git"
52
52
  },
53
53
  "scripts": {
54
+ "integration-test-0.19.0": "DOCKER_LND_VERSION=v0.19.0-beta npm run test",
54
55
  "integration-test-0.18.5": "DOCKER_LND_VERSION=v0.18.5-beta npm run test",
55
56
  "integration-test-0.18.4": "DOCKER_LND_VERSION=v0.18.4-beta npm run test",
56
57
  "integration-test-0.18.3": "DOCKER_LND_VERSION=v0.18.3-beta npm run test",
@@ -76,5 +77,5 @@
76
77
  "integration-test-0.14.4": "DOCKER_LND_VERSION=v0.14.4-beta npm run test",
77
78
  "test": "echo $DOCKER_LND_VERSION && node test/runner"
78
79
  },
79
- "version": "57.25.0"
80
+ "version": "57.25.1"
80
81
  }
@@ -7,6 +7,7 @@ const {spawnLightningCluster} = require('ln-docker-daemons');
7
7
  const {getHeight} = require('./../../');
8
8
 
9
9
  const confirmationCount = 6;
10
+ const interval = 100;
10
11
  const times = 100;
11
12
 
12
13
  // Get height should return height
@@ -17,7 +18,7 @@ test(`Get height`, async () => {
17
18
 
18
19
  const startHeight = (await getHeight({lnd})).current_block_height;
19
20
 
20
- await asyncRetry({times}, async () => {
21
+ await asyncRetry({interval, times}, async () => {
21
22
  await generate({});
22
23
 
23
24
  const endHeight = (await getHeight({lnd})).current_block_height;
@@ -8,8 +8,8 @@ const {createChainAddress} = require('./../../');
8
8
  const {getChainBalance} = require('./../../');
9
9
  const {getChainFeeEstimate} = require('./../../');
10
10
 
11
- const expectedFee = 9250;
12
- const expectedFeeRate = 50;
11
+ const expectedFee = 4625;
12
+ const expectedFeeRate = 25;
13
13
  const format = 'np2wpkh';
14
14
  const size = 2;
15
15
  const times = 200;
@@ -44,11 +44,18 @@ test(`Get chain fee estimate`, async () => {
44
44
  // LND 0.15.4 and below uses P2WPKH as change
45
45
  if (estimate.fee === 8650) {
46
46
  strictEqual(estimate.fee, 8650, 'Total fee is estimated');
47
+ } else if (estimate.fee === 9250) { // LND 0.18.5 and below fee rate
48
+ strictEqual(estimate.fee, 9250, 'Total fee is estimated');
47
49
  } else {
48
50
  strictEqual(estimate.fee, expectedFee, 'Total fee is estimated');
49
51
  }
50
52
 
51
- strictEqual(estimate.tokens_per_vbyte, expectedFeeRate, 'Got fee per vbyte');
53
+ // LND 0.18.5 and below fee rate is higher
54
+ if (estimate.tokens_per_vbyte === 50) {
55
+ strictEqual(estimate.tokens_per_vbyte, 50, 'Got fee/vbyte');
56
+ } else {
57
+ strictEqual(estimate.tokens_per_vbyte, expectedFeeRate, 'Got fee/vbyte');
58
+ }
52
59
 
53
60
  await kill({});
54
61
 
@@ -150,7 +150,7 @@ test('Subscribe to channels', async () => {
150
150
 
151
151
  const final = closeEvent.final_local_balance;
152
152
 
153
- equal([897190, 846655, 863366].includes(final), true, 'Close final');
153
+ equal([897190, 846655, 863366, 875633].includes(final), true, 'Close final');
154
154
 
155
155
  equal(closeEvent.capacity, channelCapacityTokens, 'Channel close capacity');
156
156
  equal(!!closeEvent.close_confirm_height, true, 'Close confirm height');
@@ -71,9 +71,12 @@ test(`Subscribe to chain transactions`, async () => {
71
71
  if (tx.fee === 7050) {
72
72
  equal(tx.fee, 7050, 'Transaction has a chain fee');
73
73
  equal(tx.tokens, 1007050, 'Tx tokens is fee + tokens sent');
74
- } else {
74
+ } else if (tx.fee === 7650) { // LND 0.18.5 and below fee rate
75
75
  equal(tx.fee, 7650, 'Transaction has a chain fee');
76
76
  equal(tx.tokens, 1007650, 'Tx tokens is fee + tokens sent');
77
+ } else {
78
+ equal(tx.fee, 3825, 'Transaction has a chain fee');
79
+ equal(tx.tokens, 1003825, 'Tx tokens is fee + tokens sent');
77
80
  }
78
81
 
79
82
  if (!!tx.output_addresses.find(n => n.length < 14 || n.length > 74)) {
@@ -85,8 +85,10 @@ test(`Subscribe to settled invoice`, async () => {
85
85
  if (!!payments.length) {
86
86
  const [payment] = payments;
87
87
 
88
- if (!!payment.messages.length) {
89
- const [{type, value}] = payment.messages;
88
+ const messages = payment.messages.filter(n => n.type === tlvType);
89
+
90
+ if (!!messages.filter(n => n.type === tlvType).length) {
91
+ const [{type, value}] = messages;
90
92
 
91
93
  equal(type, tlvType, 'Payment message TLV type returned');
92
94
  equal(value, tlvValue, 'Payment message TLV value returned');
@@ -132,9 +132,11 @@ test(`Get route through hops`, async () => {
132
132
 
133
133
  const [payment] = payments;
134
134
 
135
+ const paymentMessages = payment.messages.filter(n => n.type !== '106823');
136
+
135
137
  equal(payment.total_mtokens, invoice.mtokens, 'Got MPP total mtokens');
136
138
 
137
- deepEqual(payment.messages, route.messages, 'Remote got TLV messages');
139
+ deepEqual(paymentMessages, route.messages, 'Remote got TLV messages');
138
140
 
139
141
  await kill({});
140
142
 
@@ -137,8 +137,10 @@ test(`Pay via payment details`, async () => {
137
137
  if (!!payments) {
138
138
  const [payment] = payments;
139
139
 
140
- if (!!payment && !!payment.messages.length) {
141
- const [message] = payment.messages;
140
+ const messages = payment.messages.filter(n => n.type !== '106823');
141
+
142
+ if (!!payment && !!messages.length) {
143
+ const [message] = messages;
142
144
 
143
145
  equal(message.type, tlvType, 'Got TLV type');
144
146
  equal(message.value, tlvData, 'Got TLV value');
@@ -154,8 +156,10 @@ test(`Pay via payment details`, async () => {
154
156
  if (!!payments.length) {
155
157
  const [payment] = payments;
156
158
 
157
- if (!!payment && !!payment.messages.length) {
158
- const [message] = payment.messages;
159
+ const messages = payment.messages.filter(n => n.type !== '106823');
160
+
161
+ if (!!payment && !!messages.length) {
162
+ const [message] = messages;
159
163
 
160
164
  equal(message.type, tlvType, 'Got TLV type');
161
165
  equal(message.value, tlvData, 'Got TLV value');
@@ -132,8 +132,10 @@ test(`Pay via payment request`, async () => {
132
132
  if (!!payments.length) {
133
133
  const [payment] = payments;
134
134
 
135
- if (!!payment.messages.length) {
136
- const [message] = payment.messages;
135
+ const messages = payment.messages.filter(n => n.type !== '106823');
136
+
137
+ if (!!messages.length) {
138
+ const [message] = messages;
137
139
 
138
140
  equal(message.type, tlvType, 'Got TLV message type');
139
141
  equal(message.value, tlvValue, 'Got TLV message value');
@@ -205,8 +205,10 @@ test(`Pay via routes`, async () => {
205
205
  if (!!paidInvoice.payments.length) {
206
206
  const [payment] = paidInvoice.payments;
207
207
 
208
- if (!!payment.messages.length) {
209
- const [message] = payment.messages;
208
+ const messages = payment.messages.filter(n => n.type !== '106823');
209
+
210
+ if (!!messages.length) {
211
+ const [message] = messages;
210
212
 
211
213
  equal(message.type, tlvType, 'Got message type');
212
214
  equal(message.value, tlvValue, 'Got message value');
@@ -10,6 +10,7 @@ const {getTowerServerInfo} = require('./../../');
10
10
  const {getWalletInfo} = require('./../../');
11
11
 
12
12
  const conf = ['--watchtower.active', '--wtclient.active'];
13
+ const delay = ms => new Promise(resolve => setTimeout(resolve, ms));
13
14
  const interval = 50;
14
15
  const size = 2;
15
16
  const times = 5000;
@@ -38,6 +39,9 @@ test(`Connect watchtower`, async () => {
38
39
 
39
40
  const [socket] = tower.sockets;
40
41
 
42
+ // LND 0.19.0 requires a wait before connecting
43
+ await delay(5000);
44
+
41
45
  await connectWatchtower({lnd, socket, public_key: tower.public_key});
42
46
 
43
47
  const [watcher] = (await getConnectedWatchtowers({lnd})).towers;
@@ -10,6 +10,7 @@ const {getTowerServerInfo} = require('./../../');
10
10
  const {getWalletInfo} = require('./../../');
11
11
 
12
12
  const conf = ['--watchtower.active', '--wtclient.active'];
13
+ const delay = ms => new Promise(resolve => setTimeout(resolve, ms));
13
14
  const interval = 50;
14
15
  const size = 2;
15
16
  const times = 3000;
@@ -38,6 +39,9 @@ test(`Get connected watchtowers`, async () => {
38
39
 
39
40
  const [socket] = tower.sockets;
40
41
 
42
+ // LND 0.19.0 requires a wait before connecting
43
+ await delay(5000);
44
+
41
45
  await connectWatchtower({lnd, socket, public_key: tower.public_key});
42
46
 
43
47
  const res = (await getConnectedWatchtowers({lnd}));
@@ -97,9 +97,12 @@ test(`Fund PSBT`, async () => {
97
97
  if (change.output_script.length === 44) {
98
98
  equal(change.output_script.length, 44, 'Change address is returned');
99
99
  equal(change.tokens, 4998992950, 'Got change output value');
100
- } else {
100
+ } else if (change.tokens === 4998992350) { // LND 0.18.5 and below
101
101
  equal(change.output_script.length, 68, 'Change address is returned');
102
102
  equal(change.tokens, 4998992350, 'Got change output value');
103
+ } else {
104
+ equal(change.output_script.length, 68, 'Change address is returned');
105
+ equal(change.tokens, 4998996175, 'Got change output value');
103
106
  }
104
107
 
105
108
  equal(output.tokens, tokens, 'Got expected tokens output');
@@ -11,7 +11,12 @@ test(`Get chain fee rate`, async () => {
11
11
 
12
12
  const feeRate = await getChainFeeRate({lnd});
13
13
 
14
- equal(feeRate.tokens_per_vbyte, 50, 'Fee rate is returned');
14
+ // LND 0.18.5 and below return 50
15
+ if (feeRate.tokens_per_vbyte === 50) {
16
+ equal(feeRate.tokens_per_vbyte, 50, 'Fee rate is returned');
17
+ } else {
18
+ equal(feeRate.tokens_per_vbyte, 25, 'Fee rate is returned');
19
+ }
15
20
 
16
21
  await kill({});
17
22
 
@@ -35,16 +35,18 @@ test(`Request chain fee increase`, async () => {
35
35
 
36
36
  const bump = (await getUtxos({lnd})).utxos.find(n => n.tokens === tokens);
37
37
 
38
- try {
39
- await requestChainFeeIncrease({
40
- lnd,
41
- transaction_id: bump.transaction_id,
42
- transaction_vout: bump.transaction_vout + 1,
43
- });
44
- fail('Expected chain fee increase rejected');
45
- } catch (err) {
46
- deepEqual(err, [404, 'SpecifiedOutpointNotFoundInWalletUtxos'], '404');
47
- }
38
+ // // LND 0.19.0 does not support this error
39
+ // try {
40
+ // await requestChainFeeIncrease({
41
+ // lnd,
42
+ // transaction_id: bump.transaction_id,
43
+ // transaction_vout: bump.transaction_vout + 1,
44
+ // });
45
+ //
46
+ // fail('Expected chain fee increase rejected');
47
+ // } catch (err) {
48
+ // deepEqual(err, [404, 'SpecifiedOutpointNotFoundInWalletUtxos'], '404');
49
+ // }
48
50
 
49
51
  await requestChainFeeIncrease({
50
52
  lnd,
@@ -53,9 +55,9 @@ test(`Request chain fee increase`, async () => {
53
55
  });
54
56
  } catch (err) {
55
57
  equal(err, null, 'Expected no error');
58
+ } finally {
59
+ await kill({});
56
60
  }
57
61
 
58
- await kill({});
59
-
60
62
  return;
61
63
  });