ln-service 56.0.0 → 56.2.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.
- package/CHANGELOG.md +11 -0
- package/README.md +4 -1
- package/package.json +5 -3
- package/test/integration/test_delete_pending_channel.js +3 -1
- package/test/integration/test_get_channels.js +4 -13
- package/test/integration/test_open_channels.js +1 -1
- package/test/integration/test_subscribe_to_channels.js +1 -0
- package/test/integration/test_subscribe_to_open_requests.js +1 -0
- package/test/integration/test_subscribe_to_rpc_requests.js +39 -27
- package/test/integration/test_trusted_funding.js +6 -6
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,16 @@
|
|
|
1
1
|
# Versions
|
|
2
2
|
|
|
3
|
+
## 56.2.0
|
|
4
|
+
|
|
5
|
+
- `getChannels`: Add support for `type` to show channel type
|
|
6
|
+
- `getWalletInfo`: Add support for LND 0.16.2
|
|
7
|
+
- `subscribeToChannels`: Add support for `channel_opened` `type` to show type
|
|
8
|
+
|
|
9
|
+
## 56.1.0
|
|
10
|
+
|
|
11
|
+
- `getWalletInfo`: Add support for LND 0.16.1
|
|
12
|
+
- `subscribeToOpenRequests`: Add `type` for channel request commitment type
|
|
13
|
+
|
|
3
14
|
## 56.0.0
|
|
4
15
|
|
|
5
16
|
### Breaking Changes
|
package/README.md
CHANGED
|
@@ -9,7 +9,7 @@ through npm.
|
|
|
9
9
|
|
|
10
10
|
Supported LND versions:
|
|
11
11
|
|
|
12
|
-
- v0.16.0-beta
|
|
12
|
+
- v0.16.0-beta to v0.16.2-beta
|
|
13
13
|
- v0.15.2-beta to v0.15.5-beta
|
|
14
14
|
- v0.14.4-beta to v0.14.5-beta
|
|
15
15
|
|
|
@@ -1745,6 +1745,7 @@ Requires `offchain:read` permission
|
|
|
1745
1745
|
[time_online]: <Monitoring Uptime Channel Up Milliseconds Number>
|
|
1746
1746
|
transaction_id: <Blockchain Transaction Id String>
|
|
1747
1747
|
transaction_vout: <Blockchain Transaction Vout Number>
|
|
1748
|
+
[type]: <Channel Commitment Transaction Type String>
|
|
1748
1749
|
unsettled_balance: <Unsettled Balance Tokens Number>
|
|
1749
1750
|
}]
|
|
1750
1751
|
}
|
|
@@ -5332,6 +5333,7 @@ Requires `offchain:read` permission
|
|
|
5332
5333
|
sent: <Sent Tokens Number>
|
|
5333
5334
|
transaction_id: <Blockchain Transaction Id String>
|
|
5334
5335
|
transaction_vout: <Blockchain Transaction Vout Number>
|
|
5336
|
+
[type]: <Channel Commitment Transaction Type String>
|
|
5335
5337
|
unsettled_balance: <Unsettled Balance Tokens Number>
|
|
5336
5338
|
}
|
|
5337
5339
|
|
|
@@ -5739,6 +5741,7 @@ LND 0.15.0 and below do not support `is_trusted_funding`
|
|
|
5739
5741
|
reject: <Reject Request Function> ({
|
|
5740
5742
|
[reason]: <500 Character Limited Rejection Reason String>
|
|
5741
5743
|
}) -> {}
|
|
5744
|
+
[type]: <Channel Commitment Transaction Type String>
|
|
5742
5745
|
}
|
|
5743
5746
|
|
|
5744
5747
|
Example:
|
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.3",
|
|
14
|
-
"lightning": "9.
|
|
14
|
+
"lightning": "9.2.1",
|
|
15
15
|
"macaroon": "3.0.4",
|
|
16
16
|
"morgan": "1.10.0",
|
|
17
17
|
"ws": "8.13.0"
|
|
@@ -28,7 +28,7 @@
|
|
|
28
28
|
"bn.js": "5.2.1",
|
|
29
29
|
"bs58check": "3.0.1",
|
|
30
30
|
"ecpair": "2.1.0",
|
|
31
|
-
"ln-docker-daemons": "5.0.
|
|
31
|
+
"ln-docker-daemons": "5.0.2",
|
|
32
32
|
"p2tr": "1.3.3",
|
|
33
33
|
"portfinder": "1.0.32",
|
|
34
34
|
"psbt": "2.7.2",
|
|
@@ -56,6 +56,8 @@
|
|
|
56
56
|
"url": "https://github.com/alexbosworth/ln-service.git"
|
|
57
57
|
},
|
|
58
58
|
"scripts": {
|
|
59
|
+
"integration-test-0.16.2": "DOCKER_LND_VERSION=v0.16.2-beta npm run test",
|
|
60
|
+
"integration-test-0.16.1": "DOCKER_LND_VERSION=v0.16.1-beta npm run test",
|
|
59
61
|
"integration-test-0.16.0": "DOCKER_LND_VERSION=v0.16.0-beta npm run test",
|
|
60
62
|
"integration-test-0.15.5": "DOCKER_LND_VERSION=v0.15.5-beta npm run test",
|
|
61
63
|
"integration-test-0.15.4": "DOCKER_LND_VERSION=v0.15.4-beta npm run test",
|
|
@@ -65,5 +67,5 @@
|
|
|
65
67
|
"integration-test-0.14.4": "DOCKER_LND_VERSION=v0.14.4-beta npm run test",
|
|
66
68
|
"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"
|
|
67
69
|
},
|
|
68
|
-
"version": "56.
|
|
70
|
+
"version": "56.2.0"
|
|
69
71
|
}
|
|
@@ -30,7 +30,7 @@ const interval = 100;
|
|
|
30
30
|
const race = promises => Promise.race(promises);
|
|
31
31
|
const size = 3;
|
|
32
32
|
const timeout = 1000 * 20;
|
|
33
|
-
const times =
|
|
33
|
+
const times = 1000;
|
|
34
34
|
|
|
35
35
|
// Forfeiting a pending channel should remove the pending channel
|
|
36
36
|
test(`Forfeit pending channel`, async ({end, equal, strictSame}) => {
|
|
@@ -131,6 +131,8 @@ test(`Forfeit pending channel`, async ({end, equal, strictSame}) => {
|
|
|
131
131
|
return channel;
|
|
132
132
|
}
|
|
133
133
|
|
|
134
|
+
await broadcastChainTransaction({lnd, transaction});
|
|
135
|
+
|
|
134
136
|
await generate({});
|
|
135
137
|
|
|
136
138
|
throw new Error('ExpectedNewChannelCreated');
|
|
@@ -28,8 +28,6 @@ test(`Get channels`, async ({end, equal, ok}) => {
|
|
|
28
28
|
const {features} = await getWalletInfo({lnd});
|
|
29
29
|
const [targetChan] = (await getChannels({lnd: target.lnd})).channels;
|
|
30
30
|
|
|
31
|
-
const isAnchors = !!features.find(n => n.bit === anchorFeatureBit);
|
|
32
|
-
|
|
33
31
|
equal(targetChan.is_partner_initiated, true, 'Self-init channel');
|
|
34
32
|
|
|
35
33
|
if (!!channel.local_given) {
|
|
@@ -55,24 +53,16 @@ test(`Get channels`, async ({end, equal, ok}) => {
|
|
|
55
53
|
equal(channel.remote_min_htlc_mtokens, '1', 'Remote min HTLC mtokens');
|
|
56
54
|
}
|
|
57
55
|
|
|
58
|
-
// LND 0.11.1 and below do not support anchor channels
|
|
59
|
-
if (isAnchors) {
|
|
60
|
-
equal(channel.local_balance, 896530, 'Local balance');
|
|
61
|
-
equal(channel.commit_transaction_fee, 2810, 'Commit fee');
|
|
62
|
-
equal(channel.commit_transaction_weight, 1116, 'Commit weight');
|
|
63
|
-
} else {
|
|
64
|
-
equal(channel.local_balance, 890950, 'Local balance');
|
|
65
|
-
equal(channel.commit_transaction_fee, 9050, 'Commit fee');
|
|
66
|
-
equal(channel.commit_transaction_weight, 724, 'Commit weight');
|
|
67
|
-
}
|
|
68
|
-
|
|
69
56
|
equal(channel.capacity, 1000000, 'Channel capacity');
|
|
57
|
+
equal(channel.commit_transaction_fee, 2810, 'Commit fee');
|
|
58
|
+
equal(channel.commit_transaction_weight, 1116, 'Commit weight');
|
|
70
59
|
equal(channel.id, chan.id, 'Channel id returned');
|
|
71
60
|
equal(channel.is_active, true, 'Channel active');
|
|
72
61
|
equal(channel.is_closing, false, 'Channel not closing');
|
|
73
62
|
equal(channel.is_opening, false, 'Channel not opening');
|
|
74
63
|
equal(channel.is_partner_initiated, false, 'Partner initiated channel');
|
|
75
64
|
equal(channel.is_private, false, 'Channel not private');
|
|
65
|
+
equal(channel.local_balance, 896530, 'Local balance');
|
|
76
66
|
equal(channel.local_reserve, 10000, 'Local reserve');
|
|
77
67
|
equal(channel.partner_public_key, target.id, 'Pubkey');
|
|
78
68
|
equal(channel.pending_payments.length, 0, 'No pending payments');
|
|
@@ -82,6 +72,7 @@ test(`Get channels`, async ({end, equal, ok}) => {
|
|
|
82
72
|
equal(channel.sent, 0, 'Channel sent');
|
|
83
73
|
equal(channel.transaction_id, chan.transaction_id, 'Chan funding tx id');
|
|
84
74
|
equal(channel.transaction_vout, 0, 'Channel transactin vout');
|
|
75
|
+
equal(channel.type, 'anchor', 'Channel type is returned');
|
|
85
76
|
equal(channel.unsettled_balance, 0, 'Channel unsettled balance');
|
|
86
77
|
|
|
87
78
|
await kill({});
|
|
@@ -121,6 +121,7 @@ test('Subscribe to channels', async ({end, equal, fail}) => {
|
|
|
121
121
|
equal(openEvent.sent, 0, 'No tokens sent yet');
|
|
122
122
|
equal(openEvent.transaction_id, channelOpen.transaction_id, 'Funding tx id');
|
|
123
123
|
equal(openEvent.transaction_vout, channelOpen.transaction_vout, 'Fund vout');
|
|
124
|
+
equal(openEvent.type, 'anchor', 'Got channel type');
|
|
124
125
|
equal(openEvent.unsettled_balance, 0, 'No unsettled balance');
|
|
125
126
|
|
|
126
127
|
// Wait for the channel close to confirm
|
|
@@ -90,6 +90,7 @@ test(`Subscribe to open requests`, async ({end, equal, fail, ok}) => {
|
|
|
90
90
|
ok(request.min_chain_output >= dustLimit, 'Dust limit tokens returned');
|
|
91
91
|
equal(request.min_htlc_mtokens, '1', 'Got min htlc amount');
|
|
92
92
|
equal(request.partner_public_key, target.id, 'Got pubkey');
|
|
93
|
+
equal(request.type, 'anchor', 'Channel type is returned');
|
|
93
94
|
|
|
94
95
|
request.accept({
|
|
95
96
|
cooperative_close_address: address,
|
|
@@ -122,7 +122,7 @@ test(`Subscribe to RPC requests`, async ({end, equal, fail, strictSame}) => {
|
|
|
122
122
|
subscription.removeAllListeners();
|
|
123
123
|
}
|
|
124
124
|
|
|
125
|
-
{
|
|
125
|
+
try {
|
|
126
126
|
const {subscription} = await subscribeToRpcRequests({
|
|
127
127
|
lnd,
|
|
128
128
|
id: 'stop channel give tokens',
|
|
@@ -166,10 +166,14 @@ test(`Subscribe to RPC requests`, async ({end, equal, fail, strictSame}) => {
|
|
|
166
166
|
}
|
|
167
167
|
});
|
|
168
168
|
|
|
169
|
+
await delay(2000);
|
|
170
|
+
|
|
169
171
|
subscription.removeAllListeners();
|
|
172
|
+
} catch (err) {
|
|
173
|
+
equal(err, null, 'Expected no error opening channel');
|
|
170
174
|
}
|
|
171
175
|
|
|
172
|
-
{
|
|
176
|
+
try {
|
|
173
177
|
const {subscription} = await subscribeToRpcRequests({
|
|
174
178
|
lnd,
|
|
175
179
|
id: 'stop channel close to address',
|
|
@@ -207,12 +211,14 @@ test(`Subscribe to RPC requests`, async ({end, equal, fail, strictSame}) => {
|
|
|
207
211
|
}
|
|
208
212
|
|
|
209
213
|
strictSame(code, 503, 'Close fails with server error');
|
|
210
|
-
strictSame(message, 'UnexpectedCloseChannelError', 'Close
|
|
214
|
+
strictSame(message, 'UnexpectedCloseChannelError', 'Close error');
|
|
211
215
|
strictSame(raw.err.details, 'message', 'Custom message received');
|
|
212
216
|
}
|
|
213
217
|
});
|
|
214
218
|
|
|
215
219
|
subscription.removeAllListeners();
|
|
220
|
+
} catch (err) {
|
|
221
|
+
equal(err, null, 'Expected no error');
|
|
216
222
|
}
|
|
217
223
|
|
|
218
224
|
{
|
|
@@ -236,36 +242,42 @@ test(`Subscribe to RPC requests`, async ({end, equal, fail, strictSame}) => {
|
|
|
236
242
|
}
|
|
237
243
|
});
|
|
238
244
|
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
fee_mtokens: '0',
|
|
246
|
-
hops: [{
|
|
247
|
-
channel: '0x0x1',
|
|
248
|
-
channel_capacity: 1,
|
|
245
|
+
await asyncRetry({interval, times}, async () => {
|
|
246
|
+
try {
|
|
247
|
+
// Attempt a payment
|
|
248
|
+
await payViaRoutes({
|
|
249
|
+
lnd,
|
|
250
|
+
routes: [{
|
|
249
251
|
fee: 0,
|
|
250
252
|
fee_mtokens: '0',
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
253
|
+
hops: [{
|
|
254
|
+
channel: '0x0x1',
|
|
255
|
+
channel_capacity: 1,
|
|
256
|
+
fee: 0,
|
|
257
|
+
fee_mtokens: '0',
|
|
258
|
+
forward: 0,
|
|
259
|
+
forward_mtokens: '1',
|
|
260
|
+
public_key: key,
|
|
261
|
+
timeout: 1,
|
|
262
|
+
}],
|
|
263
|
+
mtokens: '1',
|
|
254
264
|
timeout: 1,
|
|
265
|
+
tokens: 0,
|
|
255
266
|
}],
|
|
256
|
-
|
|
257
|
-
timeout: 1,
|
|
258
|
-
tokens: 0,
|
|
259
|
-
}],
|
|
260
|
-
});
|
|
267
|
+
});
|
|
261
268
|
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
269
|
+
fail('ExpectedPayViaRouteRejected');
|
|
270
|
+
} catch (err) {
|
|
271
|
+
const [code, message] = err;
|
|
265
272
|
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
273
|
+
if (message !== 'UnexpectedErrorWhenPayingViaRoute') {
|
|
274
|
+
throw err;
|
|
275
|
+
}
|
|
276
|
+
|
|
277
|
+
equal(code, 503);
|
|
278
|
+
equal(message, 'UnexpectedErrorWhenPayingViaRoute');
|
|
279
|
+
}
|
|
280
|
+
});
|
|
269
281
|
|
|
270
282
|
subscription.removeAllListeners();
|
|
271
283
|
}
|
|
@@ -205,13 +205,13 @@ test(`Open unconfirmed channels`, async ({end, equal, match, strictSame}) => {
|
|
|
205
205
|
funding: signedPrivate.psbt,
|
|
206
206
|
});
|
|
207
207
|
|
|
208
|
-
// Generate the channel into a block
|
|
209
|
-
await broadcastChainTransaction({
|
|
210
|
-
lnd,
|
|
211
|
-
transaction: signedPrivate.transaction,
|
|
212
|
-
});
|
|
213
|
-
|
|
214
208
|
const privateConfirmed = await asyncRetry({interval, times}, async () => {
|
|
209
|
+
// Generate the channel into a block
|
|
210
|
+
await broadcastChainTransaction({
|
|
211
|
+
lnd,
|
|
212
|
+
transaction: signedPrivate.transaction,
|
|
213
|
+
});
|
|
214
|
+
|
|
215
215
|
await generate({});
|
|
216
216
|
|
|
217
217
|
const [confirmed] = (await getChannels({lnd})).channels;
|