ln-service 56.1.0 → 56.3.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 +12 -0
- package/README.md +7 -1
- package/package.json +4 -3
- package/test/integration/test_delete_pending_channel.js +3 -1
- package/test/integration/test_get_channels.js +4 -13
- package/test/integration/test_get_failed_payments.js +1 -0
- package/test/integration/test_subscribe_to_channels.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,17 @@
|
|
|
1
1
|
# Versions
|
|
2
2
|
|
|
3
|
+
## 56.3.0
|
|
4
|
+
|
|
5
|
+
- `subscribeToPastPayment`, `subscribeToPayViaDetails`,
|
|
6
|
+
`subscribeToPayViaRequest`, `subscribeToPayments`: Add `id` for `failed`
|
|
7
|
+
payment hash
|
|
8
|
+
|
|
9
|
+
## 56.2.0
|
|
10
|
+
|
|
11
|
+
- `getChannels`: Add support for `type` to show channel type
|
|
12
|
+
- `getWalletInfo`: Add support for LND 0.16.2
|
|
13
|
+
- `subscribeToChannels`: Add support for `channel_opened` `type` to show type
|
|
14
|
+
|
|
3
15
|
## 56.1.0
|
|
4
16
|
|
|
5
17
|
- `getWalletInfo`: Add support for LND 0.16.1
|
package/README.md
CHANGED
|
@@ -9,7 +9,7 @@ through npm.
|
|
|
9
9
|
|
|
10
10
|
Supported LND versions:
|
|
11
11
|
|
|
12
|
-
- v0.16.0-beta to v0.16.
|
|
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
|
|
|
@@ -5807,6 +5809,7 @@ Requires `offchain:read` permission
|
|
|
5807
5809
|
|
|
5808
5810
|
@event 'failed'
|
|
5809
5811
|
{
|
|
5812
|
+
id: <Payment Hash Hex String>
|
|
5810
5813
|
is_insufficient_balance: <Failed Due To Lack of Balance Bool>
|
|
5811
5814
|
is_invalid_payment: <Failed Due to Payment Rejected At Destination Bool>
|
|
5812
5815
|
is_pathfinding_timeout: <Failed Due to Pathfinding Timeout Bool>
|
|
@@ -5991,6 +5994,7 @@ Preferred `confidence` is not supported on LND 0.14.5 and below
|
|
|
5991
5994
|
|
|
5992
5995
|
@event 'failed'
|
|
5993
5996
|
{
|
|
5997
|
+
id: <Payment Hash Hex String>
|
|
5994
5998
|
is_insufficient_balance: <Failed Due To Lack of Balance Bool>
|
|
5995
5999
|
is_invalid_payment: <Failed Due to Invalid Payment Bool>
|
|
5996
6000
|
is_pathfinding_timeout: <Failed Due to Pathfinding Timeout Bool>
|
|
@@ -6145,6 +6149,7 @@ Preferred `confidence` is not supported on LND 0.14.5 and below
|
|
|
6145
6149
|
|
|
6146
6150
|
@event 'failed'
|
|
6147
6151
|
{
|
|
6152
|
+
id: <Payment Hash Hex String>
|
|
6148
6153
|
is_insufficient_balance: <Failed Due To Lack of Balance Bool>
|
|
6149
6154
|
is_invalid_payment: <Failed Due to Invalid Payment Bool>
|
|
6150
6155
|
is_pathfinding_timeout: <Failed Due to Pathfinding Timeout Bool>
|
|
@@ -6478,6 +6483,7 @@ Note: Method not supported on LND 0.15.5 and below
|
|
|
6478
6483
|
|
|
6479
6484
|
@event 'failed'
|
|
6480
6485
|
{
|
|
6486
|
+
id: <Payment Hash Hex String>
|
|
6481
6487
|
is_insufficient_balance: <Failed Due To Lack of Balance Bool>
|
|
6482
6488
|
is_invalid_payment: <Failed Due to Payment Rejected At Destination Bool>
|
|
6483
6489
|
is_pathfinding_timeout: <Failed Due to Pathfinding Timeout Bool>
|
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.3.0",
|
|
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,7 @@
|
|
|
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",
|
|
59
60
|
"integration-test-0.16.1": "DOCKER_LND_VERSION=v0.16.1-beta npm run test",
|
|
60
61
|
"integration-test-0.16.0": "DOCKER_LND_VERSION=v0.16.0-beta npm run test",
|
|
61
62
|
"integration-test-0.15.5": "DOCKER_LND_VERSION=v0.15.5-beta npm run test",
|
|
@@ -66,5 +67,5 @@
|
|
|
66
67
|
"integration-test-0.14.4": "DOCKER_LND_VERSION=v0.14.4-beta npm run test",
|
|
67
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"
|
|
68
69
|
},
|
|
69
|
-
"version": "56.
|
|
70
|
+
"version": "56.3.0"
|
|
70
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 = 2000;
|
|
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
|
|
@@ -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;
|