ln-service 53.6.0 → 53.7.3
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 +11 -3
- package/index.js +2 -2
- package/package.json +5 -4
- package/test/integration/test_add_peer.js +26 -20
- package/test/integration/test_delete_pending_channel.js +5 -2
- package/test/integration/test_get_closed_channels.js +0 -2
- package/test/integration/test_get_failed_payments.js +123 -119
- package/test/integration/test_get_invoice.js +0 -1
- package/test/integration/test_get_node.js +65 -49
- package/test/integration/test_get_peers.js +32 -21
- package/test/integration/test_get_pending_force.js +1 -1
- package/test/integration/test_get_wallet_info.js +35 -18
- package/test/integration/test_open_channels.js +22 -15
- package/test/integration/test_pay.js +0 -1
- package/test/integration/test_pay_private_invoice.js +0 -1
- package/test/integration/test_propose_channel.js +438 -421
- package/test/integration/test_remove_peer.js +13 -9
- package/test/integration/test_send_message_to_peer.js +39 -28
- package/test/integration/test_subscribe_to_channels.js +1 -2
- package/test/integration/test_subscribe_to_invoices.js +80 -78
- package/test/integration/test_subscribe_to_peer_messages.js +81 -73
- package/test/integration/test_subscribe_to_peers.js +23 -19
- package/test/invoicesrpc-integration/test_get_sweep_transactions.js +0 -2
- package/test/invoicesrpc-integration/test_subscribe_cancel_invoice.js +0 -1
- package/test/macros/wait_for_channel.js +1 -1
- package/test/routerrpc-integration/test_delete_forwarding_reputations.js +61 -27
- package/test/routerrpc-integration/test_get_forwarding_reputations.js +74 -42
- package/test/routerrpc-integration/test_get_route_confidence.js +38 -34
- package/test/routerrpc-integration/test_get_route_through_hops.js +45 -17
- package/test/routerrpc-integration/test_multipath_payment.js +0 -1
- package/test/routerrpc-integration/test_pay_via_payment_details.js +118 -111
- package/test/routerrpc-integration/test_pay_via_payment_request.js +92 -80
- package/test/routerrpc-integration/test_pay_via_routes.js +19 -1
- package/test/routerrpc-integration/test_probe_for_route.js +78 -74
- package/test/routerrpc-integration/test_subscribe_to_forward_requests.js +2 -3
- package/test/routerrpc-integration/test_subscribe_to_forwards.js +518 -505
- package/test/routerrpc-integration/test_subscribe_to_past_payments.js +0 -3
- package/test/tower_clientrpc-integration/test_get_connected_watchtowers.js +0 -3
- package/test/walletrpc-integration/test_fund_psbt.js +113 -1
- package/test/walletrpc-integration/test_partially_sign_psbt.js +12 -5
- package/test/walletrpc-integration/test_sign_psbt.js +4 -1
|
@@ -14,21 +14,25 @@ test(`Remove a peer`, async ({end, equal}) => {
|
|
|
14
14
|
|
|
15
15
|
const [{id, lnd}, target] = nodes;
|
|
16
16
|
|
|
17
|
-
|
|
18
|
-
await
|
|
19
|
-
|
|
17
|
+
try {
|
|
18
|
+
await asyncRetry({interval: 10, times: 2000}, async () => {
|
|
19
|
+
await addPeer({lnd, public_key: target.id, socket: target.socket});
|
|
20
|
+
});
|
|
20
21
|
|
|
21
|
-
|
|
22
|
+
const {peers} = await getPeers({lnd});
|
|
22
23
|
|
|
23
|
-
|
|
24
|
+
const [targetPeer] = peers;
|
|
24
25
|
|
|
25
|
-
|
|
26
|
+
equal(targetPeer.public_key, target.id, 'Peer is added');
|
|
26
27
|
|
|
27
|
-
|
|
28
|
+
await removePeer({lnd, public_key: targetPeer.public_key});
|
|
28
29
|
|
|
29
|
-
|
|
30
|
+
const postRemovalPeers = await getPeers({lnd});
|
|
30
31
|
|
|
31
|
-
|
|
32
|
+
equal(postRemovalPeers.peers.length, [].length, 'Peer is removed');
|
|
33
|
+
} catch (err) {
|
|
34
|
+
equal(err, null, 'Expected no error');
|
|
35
|
+
}
|
|
32
36
|
|
|
33
37
|
await kill({});
|
|
34
38
|
|
|
@@ -8,7 +8,7 @@ const {subscribeToPeerMessages} = require('./../../');
|
|
|
8
8
|
|
|
9
9
|
const interval = 10;
|
|
10
10
|
const size = 2;
|
|
11
|
-
const times =
|
|
11
|
+
const times = 2000;
|
|
12
12
|
|
|
13
13
|
// Sending a message to a peer should result in the message received
|
|
14
14
|
test(`Send peer message`, async ({end, equal, strictSame}) => {
|
|
@@ -33,39 +33,50 @@ test(`Send peer message`, async ({end, equal, strictSame}) => {
|
|
|
33
33
|
}
|
|
34
34
|
}
|
|
35
35
|
|
|
36
|
-
|
|
37
|
-
await
|
|
38
|
-
|
|
36
|
+
try {
|
|
37
|
+
await asyncRetry({interval, times}, async () => {
|
|
38
|
+
await addPeer({
|
|
39
|
+
lnd,
|
|
40
|
+
public_key: target.id,
|
|
41
|
+
retry_count: 1,
|
|
42
|
+
retry_delay: 1,
|
|
43
|
+
socket: target.socket,
|
|
44
|
+
timeout: 1000,
|
|
45
|
+
});
|
|
46
|
+
});
|
|
39
47
|
|
|
40
|
-
|
|
48
|
+
const sub = subscribeToPeerMessages({lnd: target.lnd});
|
|
41
49
|
|
|
42
|
-
|
|
50
|
+
const messages = [];
|
|
43
51
|
|
|
44
|
-
|
|
52
|
+
sub.on('message_received', message => messages.push(message));
|
|
45
53
|
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
54
|
+
await asyncRetry({interval, times}, async () => {
|
|
55
|
+
await sendMessageToPeer({
|
|
56
|
+
lnd,
|
|
57
|
+
message: Buffer.from('message').toString('hex'),
|
|
58
|
+
public_key: target.id,
|
|
59
|
+
});
|
|
52
60
|
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
const [message] = messages;
|
|
61
|
+
if (!messages.length) {
|
|
62
|
+
throw new Error('ExpectedMessage');
|
|
63
|
+
}
|
|
64
|
+
});
|
|
59
65
|
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
message
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
66
|
+
const [message] = messages;
|
|
67
|
+
|
|
68
|
+
strictSame(
|
|
69
|
+
message,
|
|
70
|
+
{
|
|
71
|
+
message: Buffer.from('message').toString('hex'),
|
|
72
|
+
public_key: id,
|
|
73
|
+
type: 32768,
|
|
74
|
+
},
|
|
75
|
+
'Message successfully sent to peer'
|
|
76
|
+
);
|
|
77
|
+
} catch (err) {
|
|
78
|
+
equal(err, null, 'Expected no error');
|
|
79
|
+
}
|
|
69
80
|
|
|
70
81
|
await kill({});
|
|
71
82
|
|
|
@@ -5,7 +5,6 @@ const {test} = require('@alexbosworth/tap');
|
|
|
5
5
|
const {addPeer} = require('./../../');
|
|
6
6
|
const {closeChannel} = require('./../../');
|
|
7
7
|
const {getChainBalance} = require('./../../');
|
|
8
|
-
const {getHeight} = require('./../../');
|
|
9
8
|
const {getWalletInfo} = require('./../../');
|
|
10
9
|
const {openChannel} = require('./../../');
|
|
11
10
|
const {removePeer} = require('./../../');
|
|
@@ -16,7 +15,7 @@ const defaultFee = 1e3;
|
|
|
16
15
|
const giveTokens = 1e5;
|
|
17
16
|
const interval = 100;
|
|
18
17
|
const size = 2;
|
|
19
|
-
const times =
|
|
18
|
+
const times = 200;
|
|
20
19
|
|
|
21
20
|
// Subscribing to channels should trigger channel events
|
|
22
21
|
test('Subscribe to channels', async ({end, equal, fail}) => {
|
|
@@ -4,13 +4,9 @@ const {routeFromHops} = require('bolt07');
|
|
|
4
4
|
const {spawnLightningCluster} = require('ln-docker-daemons');
|
|
5
5
|
const {test} = require('@alexbosworth/tap');
|
|
6
6
|
|
|
7
|
-
const {cancelHodlInvoice} = require('./../../');
|
|
8
7
|
const {createInvoice} = require('./../../');
|
|
9
8
|
const {getChannel} = require('./../../');
|
|
10
|
-
const {getChannels} = require('./../../');
|
|
11
|
-
const {getHeight} = require('./../../');
|
|
12
9
|
const {pay} = require('./../../');
|
|
13
|
-
const {payViaRoutes} = require('./../../');
|
|
14
10
|
const {setupChannel} = require('./../macros');
|
|
15
11
|
const {subscribeToInvoices} = require('./../../');
|
|
16
12
|
|
|
@@ -37,107 +33,113 @@ test('Subscribe to invoices', async ({end, equal, fail}) => {
|
|
|
37
33
|
|
|
38
34
|
const destination = control.id;
|
|
39
35
|
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
generate,
|
|
43
|
-
lnd,
|
|
44
|
-
give: 1e5,
|
|
45
|
-
to: target,
|
|
46
|
-
});
|
|
36
|
+
try {
|
|
37
|
+
await generate({count: 100});
|
|
47
38
|
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
// Created invoices are emitted
|
|
57
|
-
{
|
|
58
|
-
const sub = subscribeToInvoices({lnd, restart_delay_ms: 1});
|
|
39
|
+
// Create a channel from the control to the target node
|
|
40
|
+
const controlToTargetChannel = await setupChannel({
|
|
41
|
+
generate,
|
|
42
|
+
lnd,
|
|
43
|
+
give: 1e5,
|
|
44
|
+
to: target,
|
|
45
|
+
});
|
|
59
46
|
|
|
60
|
-
|
|
47
|
+
// Create a channel from the target back to the control
|
|
48
|
+
const targetToControlChannel = await setupChannel({
|
|
49
|
+
lnd: target.lnd,
|
|
50
|
+
generate: target.generate,
|
|
51
|
+
give: 1e5,
|
|
52
|
+
to: control,
|
|
53
|
+
});
|
|
61
54
|
|
|
62
|
-
|
|
55
|
+
// Created invoices are emitted
|
|
56
|
+
{
|
|
57
|
+
const sub = subscribeToInvoices({lnd, restart_delay_ms: 1});
|
|
63
58
|
|
|
64
|
-
|
|
65
|
-
await createInvoice({lnd});
|
|
59
|
+
const updates = [];
|
|
66
60
|
|
|
67
|
-
|
|
61
|
+
sub.on('invoice_updated', updated => updates.push(updated));
|
|
68
62
|
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
}
|
|
63
|
+
const update = await asyncRetry({interval, times}, async () => {
|
|
64
|
+
await createInvoice({lnd});
|
|
72
65
|
|
|
73
|
-
|
|
74
|
-
});
|
|
66
|
+
const [update] = updates;
|
|
75
67
|
|
|
76
|
-
|
|
68
|
+
if (!update) {
|
|
69
|
+
throw new Error('ExpectedInvoiceUpdate');
|
|
70
|
+
}
|
|
77
71
|
|
|
78
|
-
|
|
79
|
-
|
|
72
|
+
return update;
|
|
73
|
+
});
|
|
80
74
|
|
|
81
|
-
|
|
82
|
-
{
|
|
83
|
-
const sub = subscribeToInvoices({lnd, restart_delay_ms: 1});
|
|
75
|
+
equal(update.tokens, 0, 'Invoiced zero');
|
|
84
76
|
|
|
85
|
-
|
|
77
|
+
sub.removeAllListeners();
|
|
78
|
+
}
|
|
86
79
|
|
|
87
|
-
|
|
80
|
+
// Paid invoices are emitted
|
|
81
|
+
{
|
|
82
|
+
const sub = subscribeToInvoices({lnd, restart_delay_ms: 1});
|
|
88
83
|
|
|
89
|
-
|
|
90
|
-
await pay({
|
|
91
|
-
lnd: target.lnd,
|
|
92
|
-
request: (await createInvoice({lnd, tokens})).request,
|
|
93
|
-
});
|
|
84
|
+
const updates = [];
|
|
94
85
|
|
|
95
|
-
|
|
86
|
+
sub.on('invoice_updated', updated => updates.push(updated));
|
|
96
87
|
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
88
|
+
const update = await asyncRetry({interval, times}, async () => {
|
|
89
|
+
await pay({
|
|
90
|
+
lnd: target.lnd,
|
|
91
|
+
request: (await createInvoice({lnd, tokens})).request,
|
|
92
|
+
});
|
|
100
93
|
|
|
101
|
-
|
|
102
|
-
});
|
|
94
|
+
const [update] = updates.filter(n => n.is_confirmed);
|
|
103
95
|
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
equal(update.received, tokens, 'Got received tokens');
|
|
108
|
-
equal(update.received_mtokens, '10000000', 'Got invoice mtokens');
|
|
96
|
+
if (!update) {
|
|
97
|
+
throw new Error('ExpectedPaidInvoiceUpdate');
|
|
98
|
+
}
|
|
109
99
|
|
|
110
|
-
|
|
111
|
-
|
|
100
|
+
return update;
|
|
101
|
+
});
|
|
112
102
|
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
103
|
+
equal(!!update.confirmed_at, true, 'Got receive date');
|
|
104
|
+
equal(!!update.confirmed_index, true, 'Got confirm index');
|
|
105
|
+
equal(update.payments.length, 1, 'Got received HTLC');
|
|
106
|
+
equal(update.received, tokens, 'Got received tokens');
|
|
107
|
+
equal(update.received_mtokens, '10000000', 'Got invoice mtokens');
|
|
108
|
+
|
|
109
|
+
sub.removeAllListeners();
|
|
110
|
+
}
|
|
111
|
+
|
|
112
|
+
// Old invoices are emitted
|
|
113
|
+
{
|
|
114
|
+
const sub = subscribeToInvoices({
|
|
115
|
+
lnd,
|
|
116
|
+
added_after: 1,
|
|
117
|
+
restart_delay_ms: 1,
|
|
118
|
+
});
|
|
120
119
|
|
|
121
|
-
|
|
120
|
+
const updates = [];
|
|
122
121
|
|
|
123
|
-
|
|
122
|
+
sub.on('invoice_updated', updated => updates.push(updated));
|
|
124
123
|
|
|
125
|
-
|
|
126
|
-
|
|
124
|
+
const update = await asyncRetry({interval, times}, async () => {
|
|
125
|
+
const [update] = updates;
|
|
127
126
|
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
127
|
+
if (!update) {
|
|
128
|
+
throw new Error('ExpectedPastInvoiceUpdate');
|
|
129
|
+
}
|
|
131
130
|
|
|
132
|
-
|
|
133
|
-
|
|
131
|
+
return update;
|
|
132
|
+
});
|
|
134
133
|
|
|
135
|
-
|
|
134
|
+
equal(update.index, 2, 'Got past update');
|
|
136
135
|
|
|
137
|
-
|
|
136
|
+
sub.removeAllListeners();
|
|
137
|
+
}
|
|
138
|
+
} catch (err) {
|
|
139
|
+
equal(err, null, 'Expected no error');
|
|
140
|
+
} finally {
|
|
141
|
+
await kill({});
|
|
138
142
|
}
|
|
139
143
|
|
|
140
|
-
await kill({});
|
|
141
|
-
|
|
142
144
|
return end();
|
|
143
145
|
});
|
|
@@ -16,98 +16,106 @@ test(`Subscribe to peer messages`, async ({end, equal, strictSame}) => {
|
|
|
16
16
|
|
|
17
17
|
const [{lnd}, target, remote] = nodes;
|
|
18
18
|
|
|
19
|
-
await addPeer({
|
|
20
|
-
lnd,
|
|
21
|
-
public_key: target.id,
|
|
22
|
-
socket: target.socket,
|
|
23
|
-
});
|
|
24
|
-
|
|
25
|
-
await addPeer({
|
|
26
|
-
lnd: target.lnd,
|
|
27
|
-
public_key: remote.id,
|
|
28
|
-
socket: remote.socket,
|
|
29
|
-
});
|
|
30
|
-
|
|
31
19
|
try {
|
|
32
|
-
await
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
20
|
+
await asyncRetry({interval, times}, async () => {
|
|
21
|
+
await addPeer({
|
|
22
|
+
lnd,
|
|
23
|
+
public_key: target.id,
|
|
24
|
+
socket: target.socket,
|
|
25
|
+
});
|
|
36
26
|
});
|
|
37
|
-
} catch (err) {
|
|
38
|
-
const [code] = err;
|
|
39
27
|
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
28
|
+
await addPeer({
|
|
29
|
+
lnd: target.lnd,
|
|
30
|
+
public_key: remote.id,
|
|
31
|
+
socket: remote.socket,
|
|
32
|
+
});
|
|
33
|
+
|
|
34
|
+
try {
|
|
35
|
+
await sendMessageToPeer({
|
|
36
|
+
lnd,
|
|
37
|
+
message: Buffer.from('message').toString('hex'),
|
|
38
|
+
public_key: target.id,
|
|
39
|
+
});
|
|
40
|
+
} catch (err) {
|
|
41
|
+
const [code] = err;
|
|
43
42
|
|
|
44
|
-
|
|
43
|
+
// Send message to peer is not supported on LND 0.13.4 or lower
|
|
44
|
+
if (code === 501) {
|
|
45
|
+
await kill({});
|
|
46
|
+
|
|
47
|
+
return end();
|
|
48
|
+
}
|
|
45
49
|
}
|
|
46
|
-
}
|
|
47
50
|
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
51
|
+
const messages = [];
|
|
52
|
+
const targetSub = subscribeToPeerMessages({lnd: target.lnd});
|
|
53
|
+
const remoteSub = subscribeToPeerMessages({lnd: remote.lnd});
|
|
54
|
+
const targetMessages = [];
|
|
52
55
|
|
|
53
|
-
|
|
56
|
+
remoteSub.on('message_received', message => messages.push(message));
|
|
54
57
|
|
|
55
|
-
|
|
56
|
-
|
|
58
|
+
targetSub.on('message_received', async ({message, type}) => {
|
|
59
|
+
targetMessages.push(message);
|
|
57
60
|
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
+
if (type !== 40805) {
|
|
62
|
+
return;
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
// Wait for message to appear
|
|
66
|
+
return await asyncRetry({interval, times}, async () => {
|
|
67
|
+
// Relay message from control to remote
|
|
68
|
+
await sendMessageToPeer({
|
|
69
|
+
message,
|
|
70
|
+
type,
|
|
71
|
+
lnd: target.lnd,
|
|
72
|
+
public_key: remote.id,
|
|
73
|
+
});
|
|
74
|
+
|
|
75
|
+
if (!messages.length) {
|
|
76
|
+
throw new Error('ExpectedMessage');
|
|
77
|
+
}
|
|
78
|
+
});
|
|
79
|
+
});
|
|
61
80
|
|
|
62
81
|
// Wait for message to appear
|
|
63
|
-
|
|
64
|
-
|
|
82
|
+
await asyncRetry({interval, times}, async () => {
|
|
83
|
+
// Control send a message to target peer
|
|
65
84
|
await sendMessageToPeer({
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
85
|
+
lnd,
|
|
86
|
+
message: Buffer.from('message to remote').toString('hex'),
|
|
87
|
+
public_key: target.id,
|
|
88
|
+
type: 40805,
|
|
70
89
|
});
|
|
71
90
|
|
|
91
|
+
if (!targetMessages.length) {
|
|
92
|
+
throw new Error('ExpectedTargetMessageReceived');
|
|
93
|
+
}
|
|
94
|
+
});
|
|
95
|
+
|
|
96
|
+
// Wait for message to appear
|
|
97
|
+
await asyncRetry({interval, times}, async () => {
|
|
72
98
|
if (!messages.length) {
|
|
73
99
|
throw new Error('ExpectedMessage');
|
|
74
100
|
}
|
|
75
101
|
});
|
|
76
|
-
});
|
|
77
|
-
|
|
78
|
-
// Wait for message to appear
|
|
79
|
-
await asyncRetry({interval, times}, async () => {
|
|
80
|
-
// Control send a message to target peer
|
|
81
|
-
await sendMessageToPeer({
|
|
82
|
-
lnd,
|
|
83
|
-
message: Buffer.from('message to remote').toString('hex'),
|
|
84
|
-
public_key: target.id,
|
|
85
|
-
type: 40805,
|
|
86
|
-
});
|
|
87
|
-
|
|
88
|
-
if (!targetMessages.length) {
|
|
89
|
-
throw new Error('ExpectedTargetMessageReceived');
|
|
90
|
-
}
|
|
91
|
-
});
|
|
92
102
|
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
await kill({});
|
|
103
|
+
const [message] = messages;
|
|
104
|
+
|
|
105
|
+
strictSame(
|
|
106
|
+
message,
|
|
107
|
+
{
|
|
108
|
+
message: Buffer.from('message to remote').toString('hex'),
|
|
109
|
+
public_key: target.id,
|
|
110
|
+
type: 40805,
|
|
111
|
+
},
|
|
112
|
+
'Message successfully relayed through target'
|
|
113
|
+
);
|
|
114
|
+
} catch (err) {
|
|
115
|
+
equal(err, null, 'Expected no error');
|
|
116
|
+
} finally {
|
|
117
|
+
await kill({});
|
|
118
|
+
}
|
|
111
119
|
|
|
112
120
|
return end();
|
|
113
121
|
});
|
|
@@ -20,36 +20,40 @@ test(`Subscribe to peers`, async ({end, equal}) => {
|
|
|
20
20
|
|
|
21
21
|
const [{generate, lnd}, target] = nodes;
|
|
22
22
|
|
|
23
|
-
|
|
23
|
+
try {
|
|
24
|
+
const sub = subscribeToPeers({lnd});
|
|
24
25
|
|
|
25
|
-
|
|
26
|
+
sub.on('error', () => {});
|
|
26
27
|
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
28
|
+
await asyncRetry({interval, times}, async () => {
|
|
29
|
+
await addPeer({lnd, public_key: target.id, socket: target.socket});
|
|
30
|
+
});
|
|
30
31
|
|
|
31
|
-
|
|
32
|
-
|
|
32
|
+
const disconnect = removePeer({lnd, public_key: target.id});
|
|
33
|
+
const receiveDisconnect = once(sub, 'disconnected');
|
|
33
34
|
|
|
34
|
-
|
|
35
|
+
const [disconectMessage] = await all([receiveDisconnect, disconnect]);
|
|
35
36
|
|
|
36
|
-
|
|
37
|
+
const [disconnected] = disconectMessage;
|
|
37
38
|
|
|
38
|
-
|
|
39
|
+
equal(disconnected.public_key, target.id, 'Got d/c event');
|
|
39
40
|
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
41
|
+
const connect = asyncRetry({interval, times}, async () => {
|
|
42
|
+
return addPeer({lnd, public_key: target.id, socket: target.socket});
|
|
43
|
+
});
|
|
43
44
|
|
|
44
|
-
|
|
45
|
+
const receiveConnectMessage = once(sub, 'connected');
|
|
45
46
|
|
|
46
|
-
|
|
47
|
+
const [connectMessage] = await all([receiveConnectMessage, connect]);
|
|
47
48
|
|
|
48
|
-
|
|
49
|
+
const [connected] = connectMessage;
|
|
49
50
|
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
51
|
+
equal(connected.public_key, target.id, 'Got connected');
|
|
52
|
+
} catch (err) {
|
|
53
|
+
equal(err, null, 'Expected no error');
|
|
54
|
+
} finally {
|
|
55
|
+
await kill({});
|
|
56
|
+
}
|
|
53
57
|
|
|
54
58
|
return end();
|
|
55
59
|
});
|
|
@@ -10,10 +10,8 @@ const {closeChannel} = require('./../../');
|
|
|
10
10
|
const {createHodlInvoice} = require('./../../');
|
|
11
11
|
const {delay} = require('./../macros');
|
|
12
12
|
const {getChainTransactions} = require('./../../');
|
|
13
|
-
const {getChannels} = require('./../../');
|
|
14
13
|
const {getClosedChannels} = require('./../../');
|
|
15
14
|
const {getInvoice} = require('./../../');
|
|
16
|
-
const {getInvoices} = require('./../../');
|
|
17
15
|
const {getPendingChannels} = require('./../../');
|
|
18
16
|
const {getSweepTransactions} = require('./../../');
|
|
19
17
|
const {getWalletInfo} = require('./../../');
|
|
@@ -8,7 +8,6 @@ const {cancelHodlInvoice} = require('./../../');
|
|
|
8
8
|
const {createHodlInvoice} = require('./../../');
|
|
9
9
|
const {delay} = require('./../macros');
|
|
10
10
|
const {getInvoice} = require('./../../');
|
|
11
|
-
const {getInvoices} = require('./../../');
|
|
12
11
|
const {pay} = require('./../../');
|
|
13
12
|
const {setupChannel} = require('./../macros');
|
|
14
13
|
const {subscribeToInvoice} = require('./../../');
|