ln-service 54.2.0 → 54.2.2
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 +11 -0
- package/README.md +7 -9
- package/package.json +6 -17
- package/test/integration/test_get_chain_transactions.js +2 -2
- package/test/integration/test_open_channel.js +5 -1
- package/test/integration/test_open_channels.js +1 -1
- package/test/integration/test_recover_funds_from_channel.js +32 -26
- package/test/integration/test_subscribe_to_rpc_requests.js +27 -17
- package/test/routerrpc-integration/test_subscribe_to_payments.js +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,16 @@
|
|
|
1
1
|
# Versions
|
|
2
2
|
|
|
3
|
+
## 54.2.2
|
|
4
|
+
|
|
5
|
+
- `getWalletInfo`: Add support for LND 0.14.4
|
|
6
|
+
|
|
7
|
+
## 54.2.1
|
|
8
|
+
|
|
9
|
+
- `getWalletInfo`: Add support for LND 0.15.2
|
|
10
|
+
|
|
11
|
+
- Due to LND chain sync failure prior to LND 0.15.2, those versions are no
|
|
12
|
+
longer supported
|
|
13
|
+
|
|
3
14
|
## 54.2.0
|
|
4
15
|
|
|
5
16
|
- `openChannel`, `openChannels`: Add `base_fee_mtokens`, `fee_rate` to set
|
package/README.md
CHANGED
|
@@ -9,10 +9,8 @@ through npm.
|
|
|
9
9
|
|
|
10
10
|
Supported LND versions:
|
|
11
11
|
|
|
12
|
-
- v0.15.
|
|
13
|
-
- v0.14.
|
|
14
|
-
- v0.13.0-beta to v0.13.4-beta
|
|
15
|
-
- v0.12.0-beta to v0.12.1-beta
|
|
12
|
+
- v0.15.2-beta
|
|
13
|
+
- v0.14.4-beta
|
|
16
14
|
|
|
17
15
|
For typescript-ready methods, check out https://github.com/alexbosworth/lightning#readme
|
|
18
16
|
|
|
@@ -3571,8 +3569,8 @@ If give_tokens is set, it is a gift and it does not alter the capacity
|
|
|
3571
3569
|
|
|
3572
3570
|
Requires `offchain:write`, `onchain:write`, `peers:write` permissions
|
|
3573
3571
|
|
|
3574
|
-
`base_fee_mtokens` is not supported on LND 0.15.
|
|
3575
|
-
`fee_rate` is not supported on LND 0.15.
|
|
3572
|
+
`base_fee_mtokens` is not supported on LND 0.15.3 and below
|
|
3573
|
+
`fee_rate` is not supported on LND 0.15.3 and below
|
|
3576
3574
|
|
|
3577
3575
|
{
|
|
3578
3576
|
[base_fee_mtokens]: <Routing Base Fee Millitokens Charged String>
|
|
@@ -3624,8 +3622,8 @@ after the funding step.
|
|
|
3624
3622
|
`--protocol.option-scid-alias` and `--protocol.zero-conf` set on both sides
|
|
3625
3623
|
as well as a channel open request listener to accept the trusted funding.
|
|
3626
3624
|
|
|
3627
|
-
`base_fee_mtokens` is not supported on LND 0.15.
|
|
3628
|
-
`fee_rate` is not supported on LND 0.15.
|
|
3625
|
+
`base_fee_mtokens` is not supported on LND 0.15.3 and below
|
|
3626
|
+
`fee_rate` is not supported on LND 0.15.3 and below
|
|
3629
3627
|
|
|
3630
3628
|
{
|
|
3631
3629
|
channels: [{
|
|
@@ -6271,7 +6269,7 @@ Subscribe to outgoing payments
|
|
|
6271
6269
|
|
|
6272
6270
|
Requires `offchain:read` permission
|
|
6273
6271
|
|
|
6274
|
-
Note: Method not supported on LND 0.15.
|
|
6272
|
+
Note: Method not supported on LND 0.15.3 and below
|
|
6275
6273
|
|
|
6276
6274
|
{
|
|
6277
6275
|
lnd: <Authenticated LND API Object>
|
package/package.json
CHANGED
|
@@ -9,9 +9,9 @@
|
|
|
9
9
|
"dependencies": {
|
|
10
10
|
"bolt07": "1.8.2",
|
|
11
11
|
"cors": "2.8.5",
|
|
12
|
-
"express": "4.18.
|
|
12
|
+
"express": "4.18.2",
|
|
13
13
|
"invoices": "2.2.0",
|
|
14
|
-
"lightning": "6.2.
|
|
14
|
+
"lightning": "6.2.3",
|
|
15
15
|
"macaroon": "3.0.4",
|
|
16
16
|
"morgan": "1.10.0",
|
|
17
17
|
"ws": "8.9.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.1",
|
|
32
32
|
"p2tr": "1.3.2",
|
|
33
33
|
"portfinder": "1.0.32",
|
|
34
34
|
"psbt": "2.7.1",
|
|
@@ -56,20 +56,9 @@
|
|
|
56
56
|
"url": "https://github.com/alexbosworth/ln-service.git"
|
|
57
57
|
},
|
|
58
58
|
"scripts": {
|
|
59
|
-
"integration-test-0.15.
|
|
60
|
-
"integration-test-0.
|
|
61
|
-
"integration-test-0.14.3": "DOCKER_LND_VERSION=v0.14.3-beta npm run test",
|
|
62
|
-
"integration-test-0.14.2": "DOCKER_LND_VERSION=v0.14.2-beta npm run test",
|
|
63
|
-
"integration-test-0.14.1": "DOCKER_LND_VERSION=v0.14.1-beta npm run test",
|
|
64
|
-
"integration-test-0.14.0": "DOCKER_LND_VERSION=v0.14.0-beta npm run test",
|
|
65
|
-
"integration-test-0.13.4": "DOCKER_LND_VERSION=v0.13.4-beta npm run test",
|
|
66
|
-
"integration-test-0.13.3": "DOCKER_LND_VERSION=v0.13.3-beta npm run test",
|
|
67
|
-
"integration-test-0.13.2": "DOCKER_LND_VERSION=v0.13.2-beta npm run test",
|
|
68
|
-
"integration-test-0.13.1": "DOCKER_LND_VERSION=v0.13.1-beta npm run test",
|
|
69
|
-
"integration-test-0.13.0": "DOCKER_LND_VERSION=v0.13.0-beta npm run test",
|
|
70
|
-
"integration-test-0.12.1": "DOCKER_LND_VERSION=v0.12.1-beta npm run test",
|
|
71
|
-
"integration-test-0.12.0": "DOCKER_LND_VERSION=v0.12.0-beta npm run test",
|
|
59
|
+
"integration-test-0.15.2": "DOCKER_LND_VERSION=v0.15.2-beta npm run test",
|
|
60
|
+
"integration-test-0.14.4": "DOCKER_LND_VERSION=v0.14.4-beta npm run test",
|
|
72
61
|
"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"
|
|
73
62
|
},
|
|
74
|
-
"version": "54.2.
|
|
63
|
+
"version": "54.2.2"
|
|
75
64
|
}
|
|
@@ -20,14 +20,14 @@ test(`Get chain transactions`, async ({end, equal, strictSame}) => {
|
|
|
20
20
|
// Generate some funds for LND
|
|
21
21
|
await generate({count});
|
|
22
22
|
|
|
23
|
-
await asyncRetry({interval: 10, times:
|
|
23
|
+
await asyncRetry({interval: 10, times: 3000}, async () => {
|
|
24
24
|
const wallet = await getWalletInfo({lnd});
|
|
25
25
|
|
|
26
26
|
if (!wallet.is_synced_to_chain) {
|
|
27
27
|
throw new Error('ExpectedWalletSyncedToChain');
|
|
28
28
|
}
|
|
29
29
|
|
|
30
|
-
if (wallet.current_block_height
|
|
30
|
+
if (wallet.current_block_height < count + 1) {
|
|
31
31
|
throw new Error('ExpectedFullySyncedToChain');
|
|
32
32
|
}
|
|
33
33
|
});
|
|
@@ -66,7 +66,11 @@ test(`Open channel`, async ({end, equal}) => {
|
|
|
66
66
|
|
|
67
67
|
const policy = policies.find(n => n.public_key === id);
|
|
68
68
|
|
|
69
|
-
|
|
69
|
+
if (!policy.base_fee_mtokens) {
|
|
70
|
+
throw new Error('ExpectedKnownPolicyBaseFeeMtokens');
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
// LND 0.15.3 and below do not support setting fees on open
|
|
70
74
|
if (policy.base_fee_mtokens === defaultBaseFee) {
|
|
71
75
|
return;
|
|
72
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.3 and below do not support setting fees on open
|
|
143
143
|
if (policy.base_fee_mtokens === defaultBaseFee) {
|
|
144
144
|
return;
|
|
145
145
|
}
|
|
@@ -24,25 +24,29 @@ const times = 3000;
|
|
|
24
24
|
|
|
25
25
|
// Using a channel backup should recover funds
|
|
26
26
|
test(`Recover funds from channel`, async ({end, equal}) => {
|
|
27
|
-
const control = await
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
27
|
+
const control = await asyncRetry({interval, times}, async () => {
|
|
28
|
+
return await spawnLightningDocker({
|
|
29
|
+
seed,
|
|
30
|
+
chain_p2p_port: await getPort({port: 8000, stopPort: 9000}),
|
|
31
|
+
chain_rpc_port: await getPort({port: 9001, stopPort: 10000}),
|
|
32
|
+
chain_zmq_block_port: await getPort({port: 10001, stopPort: 11000}),
|
|
33
|
+
chain_zmq_tx_port: await getPort({port: 11001, stopPort: 12000}),
|
|
34
|
+
generate_address: generateAddress,
|
|
35
|
+
lightning_p2p_port: await getPort({port: 12001, stopPort: 13000}),
|
|
36
|
+
lightning_rpc_port: await getPort({port: 13001, stopPort: 14000}),
|
|
37
|
+
});
|
|
36
38
|
});
|
|
37
39
|
|
|
38
|
-
const target = await
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
40
|
+
const target = await asyncRetry({interval, times}, async () => {
|
|
41
|
+
return await spawnLightningDocker({
|
|
42
|
+
chain_p2p_port: await getPort({port: 8000, stopPort: 9000}),
|
|
43
|
+
chain_rpc_port: await getPort({port: 9001, stopPort: 10000}),
|
|
44
|
+
chain_zmq_block_port: await getPort({port: 10001, stopPort: 11000}),
|
|
45
|
+
chain_zmq_tx_port: await getPort({port: 11001, stopPort: 12000}),
|
|
46
|
+
generate_address: generateAddress,
|
|
47
|
+
lightning_p2p_port: await getPort({port: 12001, stopPort: 13000}),
|
|
48
|
+
lightning_rpc_port: await getPort({port: 13001, stopPort: 14000}),
|
|
49
|
+
});
|
|
46
50
|
});
|
|
47
51
|
|
|
48
52
|
await control.add_chain_peer({socket: target.chain_socket});
|
|
@@ -102,15 +106,17 @@ test(`Recover funds from channel`, async ({end, equal}) => {
|
|
|
102
106
|
|
|
103
107
|
await control.kill({});
|
|
104
108
|
|
|
105
|
-
const clone = await
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
109
|
+
const clone = await asyncRetry({interval, times}, async () => {
|
|
110
|
+
return await spawnLightningDocker({
|
|
111
|
+
seed,
|
|
112
|
+
chain_p2p_port: await getPort({port: 8000, stopPort: 9000}),
|
|
113
|
+
chain_rpc_port: await getPort({port: 9001, stopPort: 10000}),
|
|
114
|
+
chain_zmq_block_port: await getPort({port: 10001, stopPort: 11000}),
|
|
115
|
+
chain_zmq_tx_port: await getPort({port: 11001, stopPort: 12000}),
|
|
116
|
+
generate_address: generateAddress,
|
|
117
|
+
lightning_p2p_port: await getPort({port: 12001, stopPort: 13000}),
|
|
118
|
+
lightning_rpc_port: await getPort({port: 13001, stopPort: 14000}),
|
|
119
|
+
});
|
|
114
120
|
});
|
|
115
121
|
|
|
116
122
|
await clone.add_chain_peer({socket: target.chain_socket});
|
|
@@ -12,8 +12,10 @@ const {sendMessageToPeer} = require('./../../');
|
|
|
12
12
|
const {subscribeToInvoice} = require('./../../');
|
|
13
13
|
const {subscribeToRpcRequests} = require('./../../');
|
|
14
14
|
|
|
15
|
+
const interval = 10;
|
|
15
16
|
const message = '00';
|
|
16
17
|
const subscribeInvoiceUri = '/invoicesrpc.Invoices/SubscribeSingleInvoice';
|
|
18
|
+
const times = 2000;
|
|
17
19
|
|
|
18
20
|
// Subscribing to RPC requests should listen for RPC requests
|
|
19
21
|
test(`Subscribe to RPC requests`, async ({end, equal, fail, strictSame}) => {
|
|
@@ -136,23 +138,31 @@ test(`Subscribe to RPC requests`, async ({end, equal, fail, strictSame}) => {
|
|
|
136
138
|
}
|
|
137
139
|
});
|
|
138
140
|
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
err
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
141
|
+
await asyncRetry({interval, times}, async () => {
|
|
142
|
+
try {
|
|
143
|
+
// Gift some tokens in a channel
|
|
144
|
+
await openChannel({
|
|
145
|
+
lnd,
|
|
146
|
+
give_tokens: 1e5,
|
|
147
|
+
local_tokens: 1e6,
|
|
148
|
+
partner_public_key: Buffer.alloc(33, 2).toString('hex'),
|
|
149
|
+
});
|
|
150
|
+
|
|
151
|
+
fail('ExpectedChannelRejected');
|
|
152
|
+
} catch (err) {
|
|
153
|
+
const [code, message] = err;
|
|
154
|
+
|
|
155
|
+
if (message !== 'FailedToOpenChannel') {
|
|
156
|
+
throw err;
|
|
157
|
+
}
|
|
158
|
+
|
|
159
|
+
strictSame(
|
|
160
|
+
err,
|
|
161
|
+
[503, 'FailedToOpenChannel', {err: 'message'}],
|
|
162
|
+
'Channel open fails to execute'
|
|
163
|
+
);
|
|
164
|
+
}
|
|
165
|
+
});
|
|
156
166
|
|
|
157
167
|
subscription.removeAllListeners();
|
|
158
168
|
}
|
|
@@ -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.3 and below
|
|
47
47
|
if (err.details === unsupported) {
|
|
48
48
|
return isLegacy.push(error);
|
|
49
49
|
}
|