ln-service 54.3.1 → 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.
- package/CHANGELOG.md +5 -1
- package/README.md +8 -9
- package/package.json +5 -4
- package/test/chainrpc-integration/test_subscribe_to_blocks.js +5 -1
- package/test/chainrpc-integration/test_subscribe_to_chain_spend.js +2 -2
- package/test/{integration → extra-integration}/test_change_password.js +0 -0
- package/test/{integration → extra-integration}/test_get_wallet_status.js +0 -0
- package/test/{integration → extra-integration}/test_no_macaroon.js +0 -0
- package/test/{tower_clientrpc-integration → extra-integration/tower_clientrpc-integration}/test_connect_watchtower.js +0 -0
- package/test/{tower_clientrpc-integration → extra-integration/tower_clientrpc-integration}/test_disconnect_watchtower.js +1 -1
- package/test/{tower_clientrpc-integration → extra-integration/tower_clientrpc-integration}/test_get_connected_watchtowers.js +0 -0
- package/test/{tower_clientrpc-integration → extra-integration/tower_clientrpc-integration}/test_update_connected_watchtower.js +0 -0
- package/test/{tower_serverrpc-integration → extra-integration/tower_serverrpc-integration}/test_get_tower_server_info.js +0 -0
- package/test/integration/test_get_chain_fee_estimate.js +8 -2
- package/test/integration/test_get_settlement_status.js +1 -1
- package/test/integration/test_open_channel.js +1 -1
- package/test/integration/test_open_channels.js +1 -1
- package/test/integration/test_subscribe_to_transactions.js +9 -2
- package/test/macros/change_password.js +3 -3
- package/test/macros/spawn_lnd.js +3 -3
- package/test/routerrpc-integration/test_subscribe_to_forward_requests.js +3 -3
- package/test/routerrpc-integration/test_subscribe_to_payments.js +1 -1
- package/test/walletrpc-integration/test_fund_psbt.js +8 -2
package/CHANGELOG.md
CHANGED
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.
|
|
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
|
|
@@ -199,7 +199,6 @@ for `unlocker` methods.
|
|
|
199
199
|
- [payViaRoutes](#payviaroutes) - Make a payment over specified routes
|
|
200
200
|
- [prepareForChannelProposal](#prepareforchannelproposal) - setup for a channel
|
|
201
201
|
proposal
|
|
202
|
-
- [probe](#probe) - Find a payable route by attempting a fake payment
|
|
203
202
|
- [probeForRoute](#probeforroute) - Actively probe to find a payable route
|
|
204
203
|
- [proposeChannel](#proposechannel) - Offer a channel proposal to a peer
|
|
205
204
|
- [recoverFundsFromChannel](#recoverfundsfromchannel) - Restore a channel
|
|
@@ -3158,7 +3157,7 @@ await payViaRoutes({lnd, routes: [route]});
|
|
|
3158
3157
|
|
|
3159
3158
|
Get the settlement status of a received HTLC
|
|
3160
3159
|
|
|
3161
|
-
Note: this method is not supported in LND versions 0.15.
|
|
3160
|
+
Note: this method is not supported in LND versions 0.15.5 and below
|
|
3162
3161
|
|
|
3163
3162
|
Requires `offchain:read` permissions
|
|
3164
3163
|
|
|
@@ -3486,7 +3485,7 @@ const request = require('@alexbosworth/request');
|
|
|
3486
3485
|
const websocket = require('ws');
|
|
3487
3486
|
const {Writable} = require('stream');
|
|
3488
3487
|
|
|
3489
|
-
const log = output =>
|
|
3488
|
+
const log = output => log(output);
|
|
3490
3489
|
const path = '/lnd/';
|
|
3491
3490
|
const port = 8050;
|
|
3492
3491
|
|
|
@@ -3607,8 +3606,8 @@ If give_tokens is set, it is a gift and it does not alter the capacity
|
|
|
3607
3606
|
|
|
3608
3607
|
Requires `offchain:write`, `onchain:write`, `peers:write` permissions
|
|
3609
3608
|
|
|
3610
|
-
`base_fee_mtokens` is not supported on LND 0.15.
|
|
3611
|
-
`fee_rate` is not supported on LND 0.15.
|
|
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
|
|
3612
3611
|
|
|
3613
3612
|
{
|
|
3614
3613
|
[base_fee_mtokens]: <Routing Base Fee Millitokens Charged String>
|
|
@@ -3660,8 +3659,8 @@ after the funding step.
|
|
|
3660
3659
|
`--protocol.option-scid-alias` and `--protocol.zero-conf` set on both sides
|
|
3661
3660
|
as well as a channel open request listener to accept the trusted funding.
|
|
3662
3661
|
|
|
3663
|
-
`base_fee_mtokens` is not supported on LND 0.15.
|
|
3664
|
-
`fee_rate` is not supported on LND 0.15.
|
|
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
|
|
3665
3664
|
|
|
3666
3665
|
{
|
|
3667
3666
|
channels: [{
|
|
@@ -6310,7 +6309,7 @@ Subscribe to outgoing payments
|
|
|
6310
6309
|
|
|
6311
6310
|
Requires `offchain:read` permission
|
|
6312
6311
|
|
|
6313
|
-
Note: Method not supported on LND 0.15.
|
|
6312
|
+
Note: Method not supported on LND 0.15.5 and below
|
|
6314
6313
|
|
|
6315
6314
|
{
|
|
6316
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.
|
|
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.
|
|
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/
|
|
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.
|
|
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,
|
|
82
|
+
equal(vin !== undefined, true, 'Transaction input index is returned');
|
|
83
83
|
|
|
84
84
|
return gotAddressConf = true;
|
|
85
85
|
});
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
@@ -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.
|
|
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
|
}
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
@@ -6,7 +6,7 @@ const {createChainAddress} = require('./../../');
|
|
|
6
6
|
const {getChainBalance} = require('./../../');
|
|
7
7
|
const {getChainFeeEstimate} = require('./../../');
|
|
8
8
|
|
|
9
|
-
const expectedFee =
|
|
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
|
-
|
|
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.
|
|
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.
|
|
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.
|
|
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
|
-
|
|
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 = '
|
|
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:
|
|
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:
|
|
399
|
+
socket: `localhost:${getPorts.rpc}`,
|
|
400
400
|
}).lnd);
|
|
401
401
|
} catch (err) {
|
|
402
402
|
return cbk([503, 'FailedToLaunchLightningDaemon', err]);
|
package/test/macros/spawn_lnd.js
CHANGED
|
@@ -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 = '
|
|
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 =
|
|
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:
|
|
453
|
+
socket: `localhost:${getPorts.rpc}`,
|
|
454
454
|
});
|
|
455
455
|
}],
|
|
456
456
|
|
|
@@ -47,7 +47,7 @@ test(`Subscribe to requests`, async ({end, equal, rejects, strictSame}) => {
|
|
|
47
47
|
|
|
48
48
|
const sub = subscribeToForwardRequests({lnd: target.lnd});
|
|
49
49
|
|
|
50
|
-
sub.on('forward_request', forward => forward.reject());
|
|
50
|
+
sub.on('forward_request', async forward => await forward.reject());
|
|
51
51
|
|
|
52
52
|
await rejects(
|
|
53
53
|
payViaPaymentRequest({lnd, request: invoice.request}),
|
|
@@ -198,7 +198,7 @@ test(`Subscribe to requests`, async ({end, equal, rejects, strictSame}) => {
|
|
|
198
198
|
equal(forward.timeout, info.current_block_height + 83, 'Has timeout');
|
|
199
199
|
equal(forward.tokens, invoice.tokens, 'Forward has invoiced tokens');
|
|
200
200
|
|
|
201
|
-
return forward.accept();
|
|
201
|
+
return await forward.accept();
|
|
202
202
|
});
|
|
203
203
|
|
|
204
204
|
await payViaPaymentRequest({lnd, request: invoice.request});
|
|
@@ -210,7 +210,7 @@ test(`Subscribe to requests`, async ({end, equal, rejects, strictSame}) => {
|
|
|
210
210
|
const {secret} = invoice;
|
|
211
211
|
const sub = subscribeToForwardRequests({lnd: target.lnd});
|
|
212
212
|
|
|
213
|
-
sub.on('forward_request', async ({settle}) => settle({secret}));
|
|
213
|
+
sub.on('forward_request', async ({settle}) => await settle({secret}));
|
|
214
214
|
|
|
215
215
|
const paid = await payViaPaymentRequest({lnd, request: invoice.request});
|
|
216
216
|
|
|
@@ -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.
|
|
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
|
-
|
|
102
|
-
|
|
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
|
|