ln-service 53.1.1 → 53.1.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 +4 -0
- package/README.md +1 -1
- package/package.json +2 -2
- package/test/integration/test_open_channels.js +34 -14
package/CHANGELOG.md
CHANGED
package/README.md
CHANGED
|
@@ -3254,7 +3254,7 @@ after the funding step.
|
|
|
3254
3254
|
[partner_csv_delay]: <Peer Output CSV Delay Number>
|
|
3255
3255
|
[partner_socket]: <Peer Connection Host:Port String>
|
|
3256
3256
|
}]
|
|
3257
|
-
is_avoiding_broadcast: <Avoid Broadcast of All Channels Bool>
|
|
3257
|
+
[is_avoiding_broadcast]: <Avoid Broadcast of All Channels Bool>
|
|
3258
3258
|
lnd: <Authenticated LND API Object>
|
|
3259
3259
|
}
|
|
3260
3260
|
|
package/package.json
CHANGED
|
@@ -11,7 +11,7 @@
|
|
|
11
11
|
"cors": "2.8.5",
|
|
12
12
|
"express": "4.17.1",
|
|
13
13
|
"invoices": "2.0.2",
|
|
14
|
-
"lightning": "5.1.
|
|
14
|
+
"lightning": "5.1.1",
|
|
15
15
|
"macaroon": "3.0.4",
|
|
16
16
|
"morgan": "1.10.0",
|
|
17
17
|
"ws": "8.3.0"
|
|
@@ -54,5 +54,5 @@
|
|
|
54
54
|
"scripts": {
|
|
55
55
|
"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/routerrpc-integration/*.js test/signerrpc-integration/*.js test/tower_clientrpc-integration/*.js test/tower_serverrpc-integration/*.js test/walletrpc-integration/*.js"
|
|
56
56
|
},
|
|
57
|
-
"version": "53.1.
|
|
57
|
+
"version": "53.1.2"
|
|
58
58
|
}
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
const asyncMap = require('async/map');
|
|
1
2
|
const asyncRetry = require('async/retry');
|
|
2
3
|
const {extractTransaction} = require('psbt');
|
|
3
4
|
const {finalizePsbt} = require('psbt');
|
|
@@ -6,22 +7,25 @@ const {test} = require('@alexbosworth/tap');
|
|
|
6
7
|
const {transactionAsPsbt} = require('psbt');
|
|
7
8
|
|
|
8
9
|
const {addPeer} = require('./../../');
|
|
10
|
+
const {createChainAddress} = require('./../../');
|
|
9
11
|
const {delay} = require('./../macros');
|
|
10
12
|
const {fundPendingChannels} = require('./../../');
|
|
11
13
|
const {getChainBalance} = require('./../../');
|
|
12
14
|
const {getChainTransactions} = require('./../../');
|
|
13
15
|
const {getChannels} = require('./../../');
|
|
16
|
+
const {getHeight} = require('./../../');
|
|
14
17
|
const {getPeers} = require('./../../');
|
|
15
18
|
const {openChannels} = require('./../../');
|
|
16
19
|
const {sendToChainAddresses} = require('./../../');
|
|
17
20
|
|
|
18
21
|
const capacity = 1e6;
|
|
19
22
|
const count = 10;
|
|
20
|
-
const interval =
|
|
23
|
+
const interval = 10;
|
|
24
|
+
const maturity = 100;
|
|
21
25
|
const race = promises => Promise.race(promises);
|
|
22
26
|
const size = 3;
|
|
23
27
|
const timeout = 250 * 10;
|
|
24
|
-
const times =
|
|
28
|
+
const times = 2000;
|
|
25
29
|
|
|
26
30
|
// Opening channels should open up channels
|
|
27
31
|
test(`Open channels`, async ({end, equal}) => {
|
|
@@ -29,11 +33,19 @@ test(`Open channels`, async ({end, equal}) => {
|
|
|
29
33
|
|
|
30
34
|
const [{generate, lnd}, target, remote] = nodes;
|
|
31
35
|
|
|
32
|
-
await
|
|
33
|
-
|
|
34
|
-
|
|
36
|
+
await generate({count: maturity});
|
|
37
|
+
|
|
38
|
+
await asyncRetry({interval, times}, async () => {
|
|
39
|
+
const lnds = [lnd, target.lnd, remote.lnd];
|
|
40
|
+
|
|
41
|
+
const heights = await asyncMap(lnds, async lnd => {
|
|
42
|
+
return (await getHeight({lnd})).current_block_height;
|
|
43
|
+
});
|
|
44
|
+
|
|
45
|
+
const [controlHeight, targetHeight, remoteHeight] = heights;
|
|
35
46
|
|
|
36
|
-
|
|
47
|
+
if (controlHeight !== targetHeight || controlHeight !== remoteHeight) {
|
|
48
|
+
throw new Error('ExpectedSyncHeights');
|
|
37
49
|
}
|
|
38
50
|
});
|
|
39
51
|
|
|
@@ -42,11 +54,12 @@ test(`Open channels`, async ({end, equal}) => {
|
|
|
42
54
|
|
|
43
55
|
const spending = chainTx.map(({transaction}) => transaction);
|
|
44
56
|
|
|
45
|
-
await
|
|
57
|
+
const {address} = await createChainAddress({lnd});
|
|
46
58
|
|
|
47
|
-
const channels = [target, remote].map(
|
|
59
|
+
const channels = [target, remote].map(({id}) => ({
|
|
48
60
|
capacity,
|
|
49
|
-
|
|
61
|
+
cooperative_close_address: address,
|
|
62
|
+
partner_public_key: id,
|
|
50
63
|
}));
|
|
51
64
|
|
|
52
65
|
let pending;
|
|
@@ -54,6 +67,7 @@ test(`Open channels`, async ({end, equal}) => {
|
|
|
54
67
|
// Wait for peers to be connected
|
|
55
68
|
await asyncRetry({interval, times}, async () => {
|
|
56
69
|
await addPeer({lnd, public_key: remote.id, socket: remote.socket});
|
|
70
|
+
await addPeer({lnd, public_key: target.id, socket: target.socket});
|
|
57
71
|
|
|
58
72
|
if ((await getPeers({lnd})).peers.length !== channels.length) {
|
|
59
73
|
throw new Error('ExpectedConnectedPeersToOpenChannels');
|
|
@@ -67,13 +81,13 @@ test(`Open channels`, async ({end, equal}) => {
|
|
|
67
81
|
});
|
|
68
82
|
|
|
69
83
|
// Normally funding would involve an un-broadcast transaction
|
|
70
|
-
await sendToChainAddresses({lnd, send_to: pending});
|
|
84
|
+
const {id} = await sendToChainAddresses({lnd, send_to: pending});
|
|
71
85
|
|
|
72
|
-
await asyncRetry({interval, times}, async() => {
|
|
86
|
+
await asyncRetry({interval, times}, async () => {
|
|
73
87
|
const {transactions} = await getChainTransactions({lnd});
|
|
74
88
|
|
|
75
|
-
if (transactions.
|
|
76
|
-
throw new Error('
|
|
89
|
+
if (!transactions.find(n => n.id === id)) {
|
|
90
|
+
throw new Error('ExpectedChainTransaction');
|
|
77
91
|
}
|
|
78
92
|
|
|
79
93
|
return;
|
|
@@ -96,7 +110,7 @@ test(`Open channels`, async ({end, equal}) => {
|
|
|
96
110
|
});
|
|
97
111
|
|
|
98
112
|
await asyncRetry({interval, times}, async () => {
|
|
99
|
-
await generate({
|
|
113
|
+
await generate({});
|
|
100
114
|
|
|
101
115
|
const {channels} = await getChannels({lnd});
|
|
102
116
|
|
|
@@ -104,8 +118,14 @@ test(`Open channels`, async ({end, equal}) => {
|
|
|
104
118
|
throw new Error('ExpectedNewChannelsCreatedAndActive');
|
|
105
119
|
}
|
|
106
120
|
|
|
121
|
+
const [channel] = channels;
|
|
122
|
+
|
|
123
|
+
equal(channel.cooperative_close_address, address, 'Channel close addr');
|
|
124
|
+
|
|
107
125
|
return;
|
|
108
126
|
});
|
|
127
|
+
} catch (err) {
|
|
128
|
+
equal(err, null, 'No error is reported');
|
|
109
129
|
} finally {
|
|
110
130
|
return await kill({});
|
|
111
131
|
}
|