ln-service 54.10.5 → 54.10.7
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 +1 -1
- package/README.md +1 -0
- package/package.json +5 -4
- package/test/integration/test_delete_pending_channel.js +1 -1
- package/test/integration/test_subscribe_to_graph.js +109 -103
- package/test/integration/test_trusted_funding.js +1 -11
- package/test/invoicesrpc-integration/test_cancel_invoice.js +5 -0
- package/test/invoicesrpc-integration/test_get_sweep_transactions.js +3 -0
package/CHANGELOG.md
CHANGED
package/README.md
CHANGED
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": "7.1.
|
|
14
|
+
"lightning": "7.1.9",
|
|
15
15
|
"macaroon": "3.0.4",
|
|
16
16
|
"morgan": "1.10.0",
|
|
17
17
|
"ws": "8.13.0"
|
|
@@ -28,11 +28,11 @@
|
|
|
28
28
|
"bn.js": "5.2.1",
|
|
29
29
|
"bs58check": "3.0.1",
|
|
30
30
|
"ecpair": "2.1.0",
|
|
31
|
-
"ln-docker-daemons": "4.1.
|
|
31
|
+
"ln-docker-daemons": "4.1.3",
|
|
32
32
|
"p2tr": "1.3.3",
|
|
33
33
|
"portfinder": "1.0.32",
|
|
34
34
|
"psbt": "2.7.2",
|
|
35
|
-
"rimraf": "4.4.
|
|
35
|
+
"rimraf": "4.4.1",
|
|
36
36
|
"secp256k1": "5.0.0",
|
|
37
37
|
"tiny-secp256k1": "2.2.1",
|
|
38
38
|
"uuid": "9.0.0",
|
|
@@ -56,6 +56,7 @@
|
|
|
56
56
|
"url": "https://github.com/alexbosworth/ln-service.git"
|
|
57
57
|
},
|
|
58
58
|
"scripts": {
|
|
59
|
+
"integration-test-0.16.0": "DOCKER_LND_VERSION=v0.16.0-beta npm run test",
|
|
59
60
|
"integration-test-0.15.5": "DOCKER_LND_VERSION=v0.15.5-beta npm run test",
|
|
60
61
|
"integration-test-0.15.4": "DOCKER_LND_VERSION=v0.15.4-beta npm run test",
|
|
61
62
|
"integration-test-0.15.3": "DOCKER_LND_VERSION=v0.15.3-beta npm run test",
|
|
@@ -64,5 +65,5 @@
|
|
|
64
65
|
"integration-test-0.14.4": "DOCKER_LND_VERSION=v0.14.4-beta npm run test",
|
|
65
66
|
"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"
|
|
66
67
|
},
|
|
67
|
-
"version": "54.10.
|
|
68
|
+
"version": "54.10.7"
|
|
68
69
|
}
|
|
@@ -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 = 300;
|
|
34
34
|
|
|
35
35
|
// Forfeiting a pending channel should remove the pending channel
|
|
36
36
|
test(`Forfeit pending channel`, async ({end, equal, strictSame}) => {
|
|
@@ -12,147 +12,153 @@ const {subscribeToGraph} = require('./../../');
|
|
|
12
12
|
const capacity = 1e6;
|
|
13
13
|
const interval = 10;
|
|
14
14
|
const size = 2;
|
|
15
|
-
const times =
|
|
15
|
+
const times = 1000;
|
|
16
16
|
|
|
17
17
|
// Subscribing to graph should trigger graph events
|
|
18
18
|
test('Subscribe to channels', async ({end, equal, fail, strictSame}) => {
|
|
19
|
-
|
|
19
|
+
await asyncRetry({interval, times}, async () => {
|
|
20
|
+
const {kill, nodes} = await spawnLightningCluster({size});
|
|
20
21
|
|
|
21
|
-
|
|
22
|
+
const [control, target] = nodes;
|
|
22
23
|
|
|
23
|
-
|
|
24
|
+
const {generate, lnd} = control;
|
|
24
25
|
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
26
|
+
const channelClosed = [];
|
|
27
|
+
const channelUpdated = [];
|
|
28
|
+
const nodeUpdated = [];
|
|
29
|
+
const {socket} = target;
|
|
29
30
|
|
|
30
|
-
|
|
31
|
+
await delay(3000);
|
|
31
32
|
|
|
32
|
-
|
|
33
|
+
const sub = subscribeToGraph({lnd});
|
|
33
34
|
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
35
|
+
sub.on('channel_closed', update => channelClosed.push(update));
|
|
36
|
+
sub.on('channel_updated', update => channelUpdated.push(update));
|
|
37
|
+
sub.on('node_updated', update => nodeUpdated.push(update));
|
|
38
|
+
sub.on('err', err => {});
|
|
38
39
|
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
40
|
+
try {
|
|
41
|
+
const channel = await setupChannel({
|
|
42
|
+
capacity,
|
|
43
|
+
generate,
|
|
44
|
+
lnd,
|
|
45
|
+
to: target,
|
|
46
|
+
});
|
|
45
47
|
|
|
46
|
-
|
|
48
|
+
const {id} = channel;
|
|
47
49
|
|
|
48
|
-
|
|
50
|
+
const channelPolicies = await getChannel({id, lnd});
|
|
49
51
|
|
|
50
|
-
|
|
51
|
-
|
|
52
|
+
await asyncRetry({interval, times}, async () => {
|
|
53
|
+
await addPeer({lnd, public_key: target.id, socket: target.socket});
|
|
52
54
|
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
55
|
+
if (!channelUpdated.length) {
|
|
56
|
+
throw new Error('ExpectedChannelUpdated');
|
|
57
|
+
}
|
|
56
58
|
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
59
|
+
if (nodeUpdated.length !== [control, target].length) {
|
|
60
|
+
throw new Error('ExpectedNodesUpdated');
|
|
61
|
+
}
|
|
60
62
|
|
|
61
|
-
|
|
62
|
-
|
|
63
|
+
return;
|
|
64
|
+
});
|
|
63
65
|
|
|
64
|
-
|
|
66
|
+
await closeChannel({id, lnd})
|
|
65
67
|
|
|
66
|
-
|
|
67
|
-
|
|
68
|
+
await asyncRetry({interval, times}, async () => {
|
|
69
|
+
await generate({});
|
|
68
70
|
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
71
|
+
if (!channelClosed.length) {
|
|
72
|
+
throw new Error('ExpectedChannelClosed');
|
|
73
|
+
}
|
|
72
74
|
|
|
73
|
-
|
|
74
|
-
|
|
75
|
+
return;
|
|
76
|
+
});
|
|
75
77
|
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
equal(channelClose.capacity, capacity, 'Got closed channel capacity');
|
|
79
|
-
equal(!!channelClose.close_height, true, 'Got closed channel height');
|
|
80
|
-
equal(channelClose.id, id, 'Got closed channel id');
|
|
81
|
-
equal(channelClose.transaction_id, channel.transaction_id, 'Got close tx');
|
|
82
|
-
equal(channelClose.transaction_vout, channel.transaction_vout, 'Got vout');
|
|
83
|
-
equal(!!channelClose.updated_at, true, 'Got close updated at');
|
|
84
|
-
|
|
85
|
-
const expectedUpdates = channelPolicies.policies.map(policy => {
|
|
86
|
-
const peer = channelPolicies.policies
|
|
87
|
-
.find(n => n.public_key !== policy.public_key);
|
|
88
|
-
|
|
89
|
-
return {
|
|
90
|
-
capacity,
|
|
91
|
-
id,
|
|
92
|
-
base_fee_mtokens: policy.base_fee_mtokens,
|
|
93
|
-
cltv_delta: policy.cltv_delta,
|
|
94
|
-
fee_rate: policy.fee_rate,
|
|
95
|
-
is_disabled: policy.is_disabled,
|
|
96
|
-
max_htlc_mtokens: policy.max_htlc_mtokens,
|
|
97
|
-
min_htlc_mtokens: policy.min_htlc_mtokens,
|
|
98
|
-
public_keys: [policy.public_key, peer.public_key],
|
|
99
|
-
transaction_id: channel.transaction_id,
|
|
100
|
-
transaction_vout: channel.transaction_vout,
|
|
101
|
-
};
|
|
102
|
-
});
|
|
78
|
+
const [channelClose] = channelClosed;
|
|
103
79
|
|
|
104
|
-
|
|
105
|
-
|
|
80
|
+
equal(channelClose.capacity, capacity, 'Got closed channel capacity');
|
|
81
|
+
equal(!!channelClose.close_height, true, 'Got closed channel height');
|
|
82
|
+
equal(channelClose.id, id, 'Got closed channel id');
|
|
83
|
+
equal(channelClose.transaction_id, channel.transaction_id, 'Got close tx');
|
|
84
|
+
equal(channelClose.transaction_vout, channel.transaction_vout, 'Got vout');
|
|
85
|
+
equal(!!channelClose.updated_at, true, 'Got close updated at');
|
|
106
86
|
|
|
107
|
-
|
|
108
|
-
|
|
87
|
+
const expectedUpdates = channelPolicies.policies.map(policy => {
|
|
88
|
+
const peer = channelPolicies.policies
|
|
89
|
+
.find(n => n.public_key !== policy.public_key);
|
|
109
90
|
|
|
110
|
-
|
|
111
|
-
|
|
91
|
+
return {
|
|
92
|
+
capacity,
|
|
93
|
+
id,
|
|
94
|
+
base_fee_mtokens: policy.base_fee_mtokens,
|
|
95
|
+
cltv_delta: policy.cltv_delta,
|
|
96
|
+
fee_rate: policy.fee_rate,
|
|
97
|
+
is_disabled: policy.is_disabled,
|
|
98
|
+
max_htlc_mtokens: policy.max_htlc_mtokens,
|
|
99
|
+
min_htlc_mtokens: policy.min_htlc_mtokens,
|
|
100
|
+
public_keys: [policy.public_key, peer.public_key],
|
|
101
|
+
transaction_id: channel.transaction_id,
|
|
102
|
+
transaction_vout: channel.transaction_vout,
|
|
103
|
+
};
|
|
104
|
+
});
|
|
112
105
|
|
|
113
|
-
|
|
106
|
+
expectedUpdates.forEach(update => {
|
|
107
|
+
const [key1, key2] = update.public_keys;
|
|
114
108
|
|
|
115
|
-
|
|
109
|
+
const gotUpdate = channelUpdated.find(chan => {
|
|
110
|
+
const [k1, k2] = chan.public_keys;
|
|
116
111
|
|
|
117
|
-
|
|
112
|
+
return key1 === k1 && key2 === k2;
|
|
113
|
+
});
|
|
118
114
|
|
|
119
|
-
|
|
120
|
-
|
|
115
|
+
equal(!!gotUpdate.updated_at, true, 'Got updated at policy date');
|
|
116
|
+
|
|
117
|
+
delete gotUpdate.updated_at;
|
|
121
118
|
|
|
119
|
+
strictSame(gotUpdate, update, 'Got expected channel policy announcement');
|
|
122
120
|
|
|
123
|
-
|
|
121
|
+
return;
|
|
122
|
+
});
|
|
124
123
|
|
|
125
|
-
const expectedControl = {
|
|
126
|
-
alias: control.id.substring(0, 20),
|
|
127
|
-
color: '#3399ff',
|
|
128
|
-
public_key: control.id,
|
|
129
|
-
sockets: gotControl.sockets,
|
|
130
|
-
};
|
|
131
124
|
|
|
132
|
-
|
|
125
|
+
const gotControl = nodeUpdated.find(n => n.public_key === control.id);
|
|
133
126
|
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
127
|
+
const expectedControl = {
|
|
128
|
+
alias: control.id.substring(0, 20),
|
|
129
|
+
color: '#3399ff',
|
|
130
|
+
public_key: control.id,
|
|
131
|
+
sockets: gotControl.sockets,
|
|
132
|
+
};
|
|
140
133
|
|
|
141
|
-
|
|
142
|
-
equal(!!gotControl.updated_at, true, 'Got control updated at');
|
|
134
|
+
const gotTarget = nodeUpdated.find(n => n.public_key === target.id);
|
|
143
135
|
|
|
144
|
-
|
|
145
|
-
|
|
136
|
+
const expectedTarget = {
|
|
137
|
+
alias: target.id.substring(0, 20),
|
|
138
|
+
color: '#3399ff',
|
|
139
|
+
public_key: target.id,
|
|
140
|
+
sockets: gotTarget.sockets,
|
|
141
|
+
};
|
|
146
142
|
|
|
147
|
-
|
|
148
|
-
|
|
143
|
+
equal(!!gotControl.features, true, 'Got control features');
|
|
144
|
+
equal(!!gotControl.updated_at, true, 'Got control updated at');
|
|
149
145
|
|
|
150
|
-
|
|
146
|
+
delete gotControl.features;
|
|
147
|
+
delete gotControl.updated_at;
|
|
151
148
|
|
|
152
|
-
|
|
153
|
-
|
|
149
|
+
delete gotTarget.features;
|
|
150
|
+
delete gotTarget.updated_at;
|
|
154
151
|
|
|
155
|
-
|
|
152
|
+
equal(!!gotTarget, true, 'Got target updated at');
|
|
156
153
|
|
|
157
|
-
|
|
154
|
+
strictSame(gotControl, expectedControl, 'Got control node announcement');
|
|
155
|
+
strictSame(gotTarget, expectedTarget, 'Got target node announcement');
|
|
156
|
+
|
|
157
|
+
await kill({});
|
|
158
|
+
} catch (err) {
|
|
159
|
+
await kill({});
|
|
160
|
+
|
|
161
|
+
throw err;
|
|
162
|
+
}
|
|
163
|
+
});
|
|
158
164
|
});
|
|
@@ -22,7 +22,7 @@ const capacity = 1e6;
|
|
|
22
22
|
const interval = 10;
|
|
23
23
|
const maturity = 100;
|
|
24
24
|
const size = 2;
|
|
25
|
-
const times =
|
|
25
|
+
const times = 4000;
|
|
26
26
|
|
|
27
27
|
// Opening unconfirmed channels should in immediate channel opening
|
|
28
28
|
test(`Open unconfirmed channels`, async ({end, equal, match, strictSame}) => {
|
|
@@ -222,19 +222,9 @@ test(`Open unconfirmed channels`, async ({end, equal, match, strictSame}) => {
|
|
|
222
222
|
throw new Error('ExpectedClosedChannel');
|
|
223
223
|
}
|
|
224
224
|
|
|
225
|
-
if (!confirmed.other_ids.length) {
|
|
226
|
-
throw new Error('ExpectedChangeToRealPrivateChannelId');
|
|
227
|
-
}
|
|
228
|
-
|
|
229
225
|
return confirmed;
|
|
230
226
|
});
|
|
231
227
|
|
|
232
|
-
equal(privateConfirmed.other_ids.length, 1, 'Got private ephemeral ids');
|
|
233
|
-
|
|
234
|
-
const [privateOtherId] = privateConfirmed.other_ids;
|
|
235
|
-
|
|
236
|
-
match(privateOtherId, /16000000x0/, 'Got private id');
|
|
237
|
-
|
|
238
228
|
const [closedChannel] = (await getClosedChannels({lnd})).channels;
|
|
239
229
|
|
|
240
230
|
equal(closedChannel.id, confirmed.id, 'Closed channel shows confirmed id');
|
|
@@ -10,6 +10,7 @@ const {cancelHodlInvoice} = require('./../../');
|
|
|
10
10
|
const {createHodlInvoice} = require('./../../');
|
|
11
11
|
const {getInvoice} = require('./../../');
|
|
12
12
|
const {getInvoices} = require('./../../');
|
|
13
|
+
const {getPayment} = require('./../../');
|
|
13
14
|
const {pay} = require('./../../');
|
|
14
15
|
const {subscribeToInvoice} = require('./../../');
|
|
15
16
|
|
|
@@ -46,6 +47,10 @@ test(`Cancel back a hodl invoice`, async ({end, equal}) => {
|
|
|
46
47
|
equal(invoice.is_confirmed, false, 'HTLC has not yet been settled');
|
|
47
48
|
equal(invoice.is_held, true, 'HTLC is locked in place');
|
|
48
49
|
|
|
50
|
+
const payment = await getPayment({lnd, id: invoice.id});
|
|
51
|
+
|
|
52
|
+
equal(payment.is_pending, true, 'payment is pending');
|
|
53
|
+
|
|
49
54
|
await cancelHodlInvoice({id, lnd: target.lnd});
|
|
50
55
|
});
|
|
51
56
|
|
|
@@ -91,6 +91,9 @@ test(`Get sweep transactions`, async ({end, equal}) => {
|
|
|
91
91
|
if (sweepTokens === 890455) {
|
|
92
92
|
equal(anchorTokens, 149, 'Sweep has tokens amount');
|
|
93
93
|
equal(sweepTokens, 890455, 'Sweep has tokens amount');
|
|
94
|
+
} else if (anchorTokens === 147) {
|
|
95
|
+
equal(anchorTokens, 147, 'Sweep has tokens amount');
|
|
96
|
+
equal(sweepTokens, 889855, 'Sweep has tokens amount');
|
|
94
97
|
} else {
|
|
95
98
|
equal(anchorTokens, 136, 'Sweep has tokens amount');
|
|
96
99
|
equal(sweepTokens, 889855, 'Sweep has tokens amount');
|