ln-service 57.24.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 +8 -0
- package/README.md +1 -0
- package/package.json +9 -8
- package/test/chainrpc-integration/test_get_height.js +2 -1
- package/test/integration/test_get_chain_fee_estimate.js +10 -3
- package/test/integration/test_subscribe_to_channels.js +1 -1
- package/test/integration/test_subscribe_to_transactions.js +4 -1
- package/test/invoicesrpc-integration/test_subscribe_settle_invoice.js +4 -2
- package/test/routerrpc-integration/test_get_route_through_hops.js +3 -1
- package/test/routerrpc-integration/test_pay_via_payment_details.js +8 -4
- package/test/routerrpc-integration/test_pay_via_payment_request.js +4 -2
- package/test/routerrpc-integration/test_pay_via_routes.js +4 -2
- package/test/signerrpc-integration/test_sign_taproot.js +7 -1
- package/test/tower_clientrpc-integration/test_connect_watchtower.js +4 -0
- package/test/tower_clientrpc-integration/test_get_connected_watchtowers.js +4 -0
- package/test/walletrpc-integration/test_fund_psbt.js +28 -9
- package/test/walletrpc-integration/test_get_chain_fee_rate.js +6 -1
- package/test/walletrpc-integration/test_request_chain_fee_increase.js +14 -12
package/CHANGELOG.md
CHANGED
package/README.md
CHANGED
package/package.json
CHANGED
|
@@ -8,8 +8,8 @@
|
|
|
8
8
|
},
|
|
9
9
|
"dependencies": {
|
|
10
10
|
"bolt07": "1.9.4",
|
|
11
|
-
"invoices": "
|
|
12
|
-
"lightning": "10.
|
|
11
|
+
"invoices": "4.0.0",
|
|
12
|
+
"lightning": "10.25.2",
|
|
13
13
|
"macaroon": "3.0.4"
|
|
14
14
|
},
|
|
15
15
|
"description": "Interaction helper for your Lightning Network daemon",
|
|
@@ -21,13 +21,13 @@
|
|
|
21
21
|
"bip32": "4.0.0",
|
|
22
22
|
"bip66": "2.0.0",
|
|
23
23
|
"bitcoinjs-lib": "6.1.7",
|
|
24
|
-
"bn.js": "5.2.
|
|
24
|
+
"bn.js": "5.2.2",
|
|
25
25
|
"bs58check": "4.0.0",
|
|
26
|
-
"ecpair": "
|
|
27
|
-
"ln-docker-daemons": "6.0.
|
|
26
|
+
"ecpair": "3.0.0",
|
|
27
|
+
"ln-docker-daemons": "6.0.25",
|
|
28
28
|
"p2tr": "2.0.0",
|
|
29
|
-
"portfinder": "1.0.
|
|
30
|
-
"psbt": "
|
|
29
|
+
"portfinder": "1.0.37",
|
|
30
|
+
"psbt": "4.0.0",
|
|
31
31
|
"rimraf": "6.0.1",
|
|
32
32
|
"tiny-secp256k1": "2.2.3",
|
|
33
33
|
"uuid": "11.1.0",
|
|
@@ -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.
|
|
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 =
|
|
12
|
-
const expectedFeeRate =
|
|
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
|
-
|
|
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
|
-
|
|
89
|
-
|
|
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(
|
|
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
|
-
|
|
141
|
-
|
|
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
|
-
|
|
158
|
-
|
|
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
|
-
|
|
136
|
-
|
|
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
|
-
|
|
209
|
-
|
|
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');
|
|
@@ -194,7 +194,10 @@ test(`Sign a taproot transaction`, async () => {
|
|
|
194
194
|
|
|
195
195
|
const unusedKey = ecp.makeRandom({network: networks.regtest});
|
|
196
196
|
|
|
197
|
-
const witnessScript = compile([
|
|
197
|
+
const witnessScript = compile([
|
|
198
|
+
Buffer.from(unusedKey.publicKey).slice(1),
|
|
199
|
+
OP_CHECKSIG,
|
|
200
|
+
]);
|
|
198
201
|
|
|
199
202
|
const branches = [{script: witnessScript}];
|
|
200
203
|
|
|
@@ -273,6 +276,9 @@ test(`Sign a taproot transaction`, async () => {
|
|
|
273
276
|
}
|
|
274
277
|
});
|
|
275
278
|
} catch (err) {
|
|
279
|
+
console.log("ERR", err);
|
|
280
|
+
await kill({});
|
|
281
|
+
|
|
276
282
|
equal(err, null, 'Expected no error');
|
|
277
283
|
}
|
|
278
284
|
|
|
@@ -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');
|
|
@@ -128,14 +131,20 @@ test(`Fund PSBT`, async () => {
|
|
|
128
131
|
const keyPair2 = ecp.makeRandom({network: networks.regtest});
|
|
129
132
|
const unusedKey = ecp.makeRandom({network: networks.regtest});
|
|
130
133
|
|
|
131
|
-
const witnessScript = compile([
|
|
134
|
+
const witnessScript = compile([
|
|
135
|
+
from(unusedKey.publicKey).slice(1),
|
|
136
|
+
OP_CHECKSIG,
|
|
137
|
+
]);
|
|
132
138
|
|
|
133
139
|
const branches = [{script: witnessScript}];
|
|
134
140
|
|
|
135
141
|
const {hash} = hashForTree({branches});
|
|
136
142
|
|
|
137
143
|
// Create a combined key using public key material
|
|
138
|
-
const combinedPoint = pointAdd(
|
|
144
|
+
const combinedPoint = pointAdd(
|
|
145
|
+
from(keyPair1.publicKey),
|
|
146
|
+
from(keyPair2.publicKey)
|
|
147
|
+
);
|
|
139
148
|
|
|
140
149
|
const output = v1OutputScript({
|
|
141
150
|
hash,
|
|
@@ -187,7 +196,10 @@ test(`Fund PSBT`, async () => {
|
|
|
187
196
|
});
|
|
188
197
|
|
|
189
198
|
// Ready for private key combining
|
|
190
|
-
const combinedKey = privateAdd(
|
|
199
|
+
const combinedKey = privateAdd(
|
|
200
|
+
from(keyPair1.privateKey),
|
|
201
|
+
from(keyPair2.privateKey)
|
|
202
|
+
);
|
|
191
203
|
|
|
192
204
|
const signedInput = signHash({
|
|
193
205
|
hash,
|
|
@@ -224,7 +236,10 @@ test(`Fund PSBT`, async () => {
|
|
|
224
236
|
|
|
225
237
|
const keyPair = ecp.makeRandom({network: networks.regtest});
|
|
226
238
|
|
|
227
|
-
const witnessScript = compile([
|
|
239
|
+
const witnessScript = compile([
|
|
240
|
+
from(keyPair.publicKey.slice(1)),
|
|
241
|
+
OP_CHECKSIG,
|
|
242
|
+
]);
|
|
228
243
|
|
|
229
244
|
const branches = [{script: witnessScript}];
|
|
230
245
|
|
|
@@ -277,7 +292,7 @@ test(`Fund PSBT`, async () => {
|
|
|
277
292
|
);
|
|
278
293
|
});
|
|
279
294
|
|
|
280
|
-
const signature = from(signSchnorr(hashToSign, keyPair.privateKey));
|
|
295
|
+
const signature = from(signSchnorr(hashToSign, from(keyPair.privateKey)));
|
|
281
296
|
|
|
282
297
|
const {block} = controlBlock({
|
|
283
298
|
external_key: output.external_key,
|
|
@@ -308,7 +323,11 @@ test(`Fund PSBT`, async () => {
|
|
|
308
323
|
}
|
|
309
324
|
});
|
|
310
325
|
} catch (err) {
|
|
326
|
+
await kill({});
|
|
327
|
+
|
|
311
328
|
equal(err, null, 'Expected no error');
|
|
329
|
+
|
|
330
|
+
return;
|
|
312
331
|
}
|
|
313
332
|
|
|
314
333
|
// A Taproot output should be funded for a regular key spend
|
|
@@ -318,7 +337,7 @@ test(`Fund PSBT`, async () => {
|
|
|
318
337
|
const keyPair = ecp.makeRandom({network: networks.regtest});
|
|
319
338
|
|
|
320
339
|
const output = v1OutputScript({
|
|
321
|
-
internal_key: keyPair.publicKey.toString('hex'),
|
|
340
|
+
internal_key: from(keyPair.publicKey).toString('hex'),
|
|
322
341
|
});
|
|
323
342
|
|
|
324
343
|
const outputScript = hexAsBuffer(output.script);
|
|
@@ -368,8 +387,8 @@ test(`Fund PSBT`, async () => {
|
|
|
368
387
|
});
|
|
369
388
|
|
|
370
389
|
const signedInput = signHash({
|
|
371
|
-
private_key: keyPair.privateKey.toString('hex'),
|
|
372
|
-
public_key: keyPair.publicKey.toString('hex'),
|
|
390
|
+
private_key: from(keyPair.privateKey).toString('hex'),
|
|
391
|
+
public_key: from(keyPair.publicKey).toString('hex'),
|
|
373
392
|
sign_hash: hashToSign.toString('hex'),
|
|
374
393
|
});
|
|
375
394
|
|
|
@@ -11,7 +11,12 @@ test(`Get chain fee rate`, async () => {
|
|
|
11
11
|
|
|
12
12
|
const feeRate = await getChainFeeRate({lnd});
|
|
13
13
|
|
|
14
|
-
|
|
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
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
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
|
});
|