ln-service 53.7.2 → 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 +1 -1
- package/package.json +3 -3
- package/test/integration/test_add_peer.js +2 -2
- package/test/integration/test_get_closed_channels.js +0 -2
- package/test/integration/test_get_invoice.js +0 -1
- package/test/integration/test_get_node.js +13 -1
- package/test/integration/test_get_peers.js +32 -21
- package/test/integration/test_get_wallet_info.js +6 -4
- package/test/integration/test_open_channels.js +2 -2
- package/test/integration/test_pay.js +0 -1
- package/test/integration/test_pay_private_invoice.js +0 -1
- 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 +0 -1
- package/test/integration/test_subscribe_to_invoices.js +80 -78
- package/test/integration/test_subscribe_to_peer_messages.js +6 -4
- 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 +42 -14
- package/test/routerrpc-integration/test_get_route_through_hops.js +24 -15
- package/test/routerrpc-integration/test_multipath_payment.js +0 -1
- package/test/routerrpc-integration/test_pay_via_payment_details.js +0 -1
- package/test/routerrpc-integration/test_pay_via_payment_request.js +92 -80
- package/test/routerrpc-integration/test_probe_for_route.js +5 -5
- package/test/routerrpc-integration/test_subscribe_to_forward_requests.js +0 -1
- package/test/routerrpc-integration/test_subscribe_to_forwards.js +11 -2
- 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 +110 -1
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
const asyncRetry = require('async/retry');
|
|
1
2
|
const {spawnLightningCluster} = require('ln-docker-daemons');
|
|
2
3
|
const {test} = require('@alexbosworth/tap');
|
|
3
4
|
|
|
@@ -5,12 +6,17 @@ const {addPeer} = require('./../../');
|
|
|
5
6
|
const {createInvoice} = require('./../../');
|
|
6
7
|
const {deleteForwardingReputations} = require('./../../');
|
|
7
8
|
const {getForwardingReputations} = require('./../../');
|
|
9
|
+
const {getNetworkGraph} = require('./../../');
|
|
8
10
|
const {payViaPaymentRequest} = require('./../../');
|
|
9
11
|
const {probeForRoute} = require('./../../');
|
|
10
12
|
const {setupChannel} = require('./../macros');
|
|
11
13
|
const {waitForRoute} = require('./../macros');
|
|
12
14
|
|
|
15
|
+
const flatten = arr => [].concat(...arr);
|
|
16
|
+
const interval = 10;
|
|
13
17
|
const size = 3;
|
|
18
|
+
const times = 1000;
|
|
19
|
+
const tlvOnionBit = 14;
|
|
14
20
|
const tokens = 1e6 / 2;
|
|
15
21
|
|
|
16
22
|
// Deleting forwarding reputations should eliminate forwarding reputations
|
|
@@ -19,45 +25,73 @@ test('Delete forwarding reputations', async ({end, equal}) => {
|
|
|
19
25
|
|
|
20
26
|
const [{generate, lnd}, target, remote] = nodes;
|
|
21
27
|
|
|
22
|
-
|
|
28
|
+
try {
|
|
29
|
+
const controlToTargetChan = await setupChannel({
|
|
30
|
+
generate,
|
|
31
|
+
lnd,
|
|
32
|
+
to: target,
|
|
33
|
+
});
|
|
23
34
|
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
35
|
+
const targetToRemoteChan = await setupChannel({
|
|
36
|
+
generate: target.generate,
|
|
37
|
+
lnd: target.lnd,
|
|
38
|
+
to: remote,
|
|
39
|
+
});
|
|
29
40
|
|
|
30
|
-
|
|
41
|
+
await addPeer({lnd, public_key: remote.id, socket: remote.socket});
|
|
31
42
|
|
|
32
|
-
|
|
43
|
+
const {id, request} = await createInvoice({tokens, lnd: remote.lnd});
|
|
33
44
|
|
|
34
|
-
|
|
45
|
+
await asyncRetry({interval, times}, async () => {
|
|
46
|
+
const {channels, nodes} = await getNetworkGraph({lnd});
|
|
35
47
|
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
equal(err, null, 'Expected no error paying payment request');
|
|
40
|
-
}
|
|
48
|
+
const limitedFeatures = nodes.find(node => {
|
|
49
|
+
return !node.features.find(n => n.bit === tlvOnionBit);
|
|
50
|
+
});
|
|
41
51
|
|
|
42
|
-
|
|
43
|
-
await probeForRoute({lnd, tokens, destination: remote.id});
|
|
44
|
-
} catch (err) {}
|
|
52
|
+
const policies = flatten(channels.map(n => n.policies));
|
|
45
53
|
|
|
46
|
-
|
|
47
|
-
const {nodes} = await getForwardingReputations({lnd});
|
|
54
|
+
const cltvDeltas = policies.map(n => n.cltv_delta);
|
|
48
55
|
|
|
49
|
-
|
|
50
|
-
|
|
56
|
+
if (!!cltvDeltas.filter(n => !n).length) {
|
|
57
|
+
throw new Error('ExpectedAllChannelPolicies');
|
|
58
|
+
}
|
|
51
59
|
|
|
52
|
-
|
|
60
|
+
if (!!limitedFeatures) {
|
|
61
|
+
throw new Error('NetworkGraphSyncIncomplete');
|
|
62
|
+
}
|
|
63
|
+
});
|
|
53
64
|
|
|
54
|
-
|
|
55
|
-
const {nodes} = await getForwardingReputations({lnd});
|
|
65
|
+
await waitForRoute({lnd, tokens, destination: remote.id});
|
|
56
66
|
|
|
57
|
-
|
|
58
|
-
|
|
67
|
+
try {
|
|
68
|
+
await payViaPaymentRequest({lnd, request});
|
|
69
|
+
} catch (err) {
|
|
70
|
+
equal(err, null, 'Expected no error paying payment request');
|
|
71
|
+
}
|
|
59
72
|
|
|
60
|
-
|
|
73
|
+
try {
|
|
74
|
+
await probeForRoute({lnd, tokens, destination: remote.id});
|
|
75
|
+
} catch (err) {}
|
|
76
|
+
|
|
77
|
+
{
|
|
78
|
+
const {nodes} = await getForwardingReputations({lnd});
|
|
79
|
+
|
|
80
|
+
equal(nodes.length, 2, 'Reputations should exist');
|
|
81
|
+
}
|
|
82
|
+
|
|
83
|
+
await deleteForwardingReputations({lnd});
|
|
84
|
+
|
|
85
|
+
{
|
|
86
|
+
const {nodes} = await getForwardingReputations({lnd});
|
|
87
|
+
|
|
88
|
+
equal(nodes.length, [].length, 'Reputations should be wiped');
|
|
89
|
+
}
|
|
90
|
+
} catch (err) {
|
|
91
|
+
equal(err, null, 'Expected no error');
|
|
92
|
+
} finally {
|
|
93
|
+
await kill({});
|
|
94
|
+
}
|
|
61
95
|
|
|
62
96
|
return end();
|
|
63
97
|
});
|
|
@@ -5,7 +5,7 @@ const {test} = require('@alexbosworth/tap');
|
|
|
5
5
|
const {addPeer} = require('./../../');
|
|
6
6
|
const {getChannels} = require('./../../');
|
|
7
7
|
const {getForwardingReputations} = require('./../../');
|
|
8
|
-
const {
|
|
8
|
+
const {getNetworkGraph} = require('./../../');
|
|
9
9
|
const {probeForRoute} = require('./../../');
|
|
10
10
|
const {setupChannel} = require('./../macros');
|
|
11
11
|
const {waitForRoute} = require('./../macros');
|
|
@@ -15,9 +15,12 @@ const channelCapacityTokens = 1e6;
|
|
|
15
15
|
const confirmationCount = 20;
|
|
16
16
|
const defaultFee = 1e3;
|
|
17
17
|
const defaultOdds = 950000;
|
|
18
|
+
const flatten = arr => [].concat(...arr);
|
|
18
19
|
const interval = 10;
|
|
20
|
+
const maturity = 100;
|
|
19
21
|
const size = 3;
|
|
20
22
|
const times = 2000;
|
|
23
|
+
const tlvOnionBit = 14;
|
|
21
24
|
const tokens = 1e6 / 2;
|
|
22
25
|
|
|
23
26
|
// Getting forwarding reputations should return reputations
|
|
@@ -26,9 +29,9 @@ test('Get forwarding reputations', async ({end, equal}) => {
|
|
|
26
29
|
|
|
27
30
|
const [{generate, id, lnd}, target, remote] = cluster.nodes;
|
|
28
31
|
|
|
29
|
-
await generate({count: 100});
|
|
30
|
-
|
|
31
32
|
try {
|
|
33
|
+
await generate({count: maturity});
|
|
34
|
+
|
|
32
35
|
// Create a channel from the control to the target node
|
|
33
36
|
await setupChannel({
|
|
34
37
|
generate,
|
|
@@ -45,22 +48,47 @@ test('Get forwarding reputations', async ({end, equal}) => {
|
|
|
45
48
|
});
|
|
46
49
|
|
|
47
50
|
await asyncRetry({interval, times}, async () => {
|
|
48
|
-
|
|
51
|
+
const {channels, nodes} = await getNetworkGraph({lnd});
|
|
52
|
+
|
|
53
|
+
const limitedFeatures = nodes.find(node => {
|
|
54
|
+
return !node.features.find(n => n.bit === tlvOnionBit);
|
|
55
|
+
});
|
|
56
|
+
|
|
57
|
+
const policies = flatten(channels.map(n => n.policies));
|
|
58
|
+
|
|
59
|
+
const cltvDeltas = policies.map(n => n.cltv_delta);
|
|
60
|
+
|
|
61
|
+
if (!!cltvDeltas.filter(n => !n).length) {
|
|
62
|
+
throw new Error('ExpectedAllChannelPolicies');
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
if (!!limitedFeatures) {
|
|
66
|
+
throw new Error('NetworkGraphSyncIncomplete');
|
|
67
|
+
}
|
|
68
|
+
});
|
|
69
|
+
|
|
70
|
+
await asyncRetry({interval, times}, async () => {
|
|
71
|
+
await generate({});
|
|
72
|
+
|
|
73
|
+
await addPeer({
|
|
74
|
+
lnd,
|
|
75
|
+
public_key: remote.id,
|
|
76
|
+
socket: remote.socket,
|
|
77
|
+
retry_count: 1,
|
|
78
|
+
retry_delay: 1,
|
|
79
|
+
timeout: 1,
|
|
80
|
+
});
|
|
49
81
|
|
|
50
82
|
const {channels} = await getChannels({lnd: remote.lnd});
|
|
51
83
|
|
|
52
84
|
await waitForRoute({lnd, tokens, destination: remote.id});
|
|
53
85
|
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
});
|
|
61
|
-
} catch (err) {
|
|
62
|
-
equal(err, null, 'Expected no error probing');
|
|
63
|
-
}
|
|
86
|
+
await probeForRoute({
|
|
87
|
+
lnd,
|
|
88
|
+
tokens,
|
|
89
|
+
destination: remote.id,
|
|
90
|
+
is_ignoring_past_failures: true,
|
|
91
|
+
});
|
|
64
92
|
|
|
65
93
|
const {nodes} = await getForwardingReputations({lnd});
|
|
66
94
|
|
|
@@ -12,16 +12,18 @@ const {getNetworkGraph} = require('./../../');
|
|
|
12
12
|
const {getRouteThroughHops} = require('./../../');
|
|
13
13
|
const {getRouteToDestination} = require('./../../');
|
|
14
14
|
const {getWalletInfo} = require('./../../');
|
|
15
|
-
const {getWalletVersion} = require('./../../');
|
|
16
15
|
const {payViaRoutes} = require('./../../');
|
|
17
16
|
const {setupChannel} = require('./../macros');
|
|
18
17
|
const {waitForRoute} = require('./../macros');
|
|
19
18
|
|
|
20
19
|
const confirmationCount = 6;
|
|
20
|
+
const flatten = arr => [].concat(...arr);
|
|
21
21
|
const interval = 10;
|
|
22
|
+
const maturity = 100;
|
|
22
23
|
const messages = [{type: '1000000', value: '01'}];
|
|
23
24
|
const size = 3;
|
|
24
25
|
const times = 1000;
|
|
26
|
+
const tlvOnionBit = 14;
|
|
25
27
|
const tokens = 100;
|
|
26
28
|
|
|
27
29
|
// Getting a route through hops should result in a route through specified hops
|
|
@@ -30,8 +32,7 @@ test(`Get route through hops`, async ({end, equal, strictSame}) => {
|
|
|
30
32
|
|
|
31
33
|
const [{generate, lnd}, target, remote] = nodes;
|
|
32
34
|
|
|
33
|
-
await target.generate({count:
|
|
34
|
-
await remote.generate({count: 100});
|
|
35
|
+
await target.generate({count: maturity});
|
|
35
36
|
|
|
36
37
|
const controlToTargetChan = await setupChannel({generate, lnd, to: target});
|
|
37
38
|
|
|
@@ -53,6 +54,26 @@ test(`Get route through hops`, async ({end, equal, strictSame}) => {
|
|
|
53
54
|
}
|
|
54
55
|
});
|
|
55
56
|
|
|
57
|
+
await asyncRetry({interval, times}, async () => {
|
|
58
|
+
const {channels, nodes} = await getNetworkGraph({lnd});
|
|
59
|
+
|
|
60
|
+
const limitedFeatures = nodes.find(node => {
|
|
61
|
+
return !node.features.find(n => n.bit === tlvOnionBit);
|
|
62
|
+
});
|
|
63
|
+
|
|
64
|
+
const policies = flatten(channels.map(n => n.policies));
|
|
65
|
+
|
|
66
|
+
const cltvDeltas = policies.map(n => n.cltv_delta);
|
|
67
|
+
|
|
68
|
+
if (!!cltvDeltas.filter(n => !n).length) {
|
|
69
|
+
throw new Error('ExpectedAllChannelPolicies');
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
if (!!limitedFeatures) {
|
|
73
|
+
throw new Error('NetworkGraphSyncIncomplete');
|
|
74
|
+
}
|
|
75
|
+
});
|
|
76
|
+
|
|
56
77
|
const invoice = await createInvoice({tokens, lnd: remote.lnd});
|
|
57
78
|
|
|
58
79
|
const {id} = invoice;
|
|
@@ -71,18 +92,6 @@ test(`Get route through hops`, async ({end, equal, strictSame}) => {
|
|
|
71
92
|
});
|
|
72
93
|
});
|
|
73
94
|
|
|
74
|
-
await asyncRetry({interval, times}, async () => {
|
|
75
|
-
const {nodes} = await getNetworkGraph({lnd});
|
|
76
|
-
|
|
77
|
-
const limitedFeatures = nodes.find(node => {
|
|
78
|
-
return !node.features.find(n => n.bit === 14);
|
|
79
|
-
});
|
|
80
|
-
|
|
81
|
-
if (!!limitedFeatures) {
|
|
82
|
-
throw new Error('NetworkGraphSyncIncomplete');
|
|
83
|
-
}
|
|
84
|
-
});
|
|
85
|
-
|
|
86
95
|
const res = await asyncRetry({interval, times}, async () => {
|
|
87
96
|
return await getRouteThroughHops({
|
|
88
97
|
lnd,
|
|
@@ -4,7 +4,6 @@ const {test} = require('@alexbosworth/tap');
|
|
|
4
4
|
const {createInvoice} = require('./../../');
|
|
5
5
|
const {getInvoice} = require('./../../');
|
|
6
6
|
const {getRouteToDestination} = require('./../../');
|
|
7
|
-
const {getWalletVersion} = require('./../../');
|
|
8
7
|
const {parsePaymentRequest} = require('./../../');
|
|
9
8
|
const {payViaPaymentRequest} = require('./../../');
|
|
10
9
|
const {payViaRoutes} = require('./../../');
|
|
@@ -8,7 +8,6 @@ const {delay} = require('./../macros');
|
|
|
8
8
|
const {getHeight} = require('./../../');
|
|
9
9
|
const {getInvoice} = require('./../../');
|
|
10
10
|
const {getInvoices} = require('./../../');
|
|
11
|
-
const {getWalletVersion} = require('./../../');
|
|
12
11
|
const {payViaPaymentDetails} = require('./../../');
|
|
13
12
|
const {setupChannel} = require('./../macros');
|
|
14
13
|
const {waitForRoute} = require('./../macros');
|
|
@@ -22,99 +22,111 @@ test(`Pay via payment request`, async ({end, equal, rejects, strictSame}) => {
|
|
|
22
22
|
|
|
23
23
|
const [{generate, lnd}, target, remote] = nodes;
|
|
24
24
|
|
|
25
|
-
const channel = await setupChannel({generate, lnd, to: target});
|
|
26
|
-
|
|
27
|
-
// Make sure that an error is returned when there is no route
|
|
28
25
|
try {
|
|
29
|
-
|
|
26
|
+
await generate({count: 100});
|
|
30
27
|
|
|
31
|
-
await
|
|
32
|
-
payViaPaymentRequest({lnd, request}),
|
|
33
|
-
[503, 'PaymentPathfindingFailedToFindPossibleRoute'],
|
|
34
|
-
'A payment with no route returns an error'
|
|
35
|
-
);
|
|
36
|
-
} catch (err) {
|
|
37
|
-
equal(err, null, 'Expected no error creating invoice');
|
|
38
|
-
}
|
|
28
|
+
const channel = await setupChannel({generate, lnd, to: target});
|
|
39
29
|
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
to: remote,
|
|
44
|
-
});
|
|
30
|
+
// Make sure that an error is returned when there is no route
|
|
31
|
+
try {
|
|
32
|
+
const {request} = await createInvoice({tokens, lnd: remote.lnd});
|
|
45
33
|
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
34
|
+
await rejects(
|
|
35
|
+
payViaPaymentRequest({lnd, request}),
|
|
36
|
+
[503, 'PaymentPathfindingFailedToFindPossibleRoute'],
|
|
37
|
+
'A payment with no route returns an error'
|
|
38
|
+
);
|
|
39
|
+
} catch (err) {
|
|
40
|
+
equal(err, null, 'Expected no error creating invoice');
|
|
41
|
+
}
|
|
49
42
|
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
const invoice = await createInvoice({tokens, lnd: remote.lnd});
|
|
55
|
-
|
|
56
|
-
const paid = await payViaPaymentRequest({
|
|
57
|
-
lnd,
|
|
58
|
-
max_timeout_height: height + 40 + 43,
|
|
59
|
-
messages: [{type: tlvType, value: tlvValue}],
|
|
60
|
-
request: invoice.request,
|
|
43
|
+
await addPeer({
|
|
44
|
+
lnd: target.lnd,
|
|
45
|
+
public_key: remote.id,
|
|
46
|
+
socket: remote.socket,
|
|
61
47
|
});
|
|
62
48
|
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
equal(paid.mtokens, '101000', 'Paid mtokens');
|
|
68
|
-
equal(paid.secret, invoice.secret, 'Paid for invoice secret');
|
|
69
|
-
|
|
70
|
-
paid.hops.forEach(n => {
|
|
71
|
-
equal(n.timeout === height + 40 || n.timeout === height + 43, true);
|
|
72
|
-
|
|
73
|
-
delete n.timeout;
|
|
74
|
-
|
|
75
|
-
return;
|
|
49
|
+
const remoteChan = await setupChannel({
|
|
50
|
+
lnd: target.lnd,
|
|
51
|
+
generate: target.generate,
|
|
52
|
+
to: remote,
|
|
76
53
|
});
|
|
77
54
|
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
{
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
55
|
+
await addPeer({lnd, public_key: remote.id, socket: remote.socket});
|
|
56
|
+
|
|
57
|
+
await waitForRoute({lnd, tokens, destination: remote.id});
|
|
58
|
+
|
|
59
|
+
// When a route exists, payment is successful
|
|
60
|
+
try {
|
|
61
|
+
const commitTxFee = channel.commit_transaction_fee;
|
|
62
|
+
const height = (await getWalletInfo({lnd})).current_block_height;
|
|
63
|
+
const invoice = await createInvoice({tokens, lnd: remote.lnd});
|
|
64
|
+
|
|
65
|
+
const paid = await payViaPaymentRequest({
|
|
66
|
+
lnd,
|
|
67
|
+
max_timeout_height: height + 40 + 43,
|
|
68
|
+
messages: [{type: tlvType, value: tlvValue}],
|
|
69
|
+
request: invoice.request,
|
|
70
|
+
});
|
|
71
|
+
|
|
72
|
+
equal(paid.confirmed_at > start, true, 'Got confirmation date');
|
|
73
|
+
equal(paid.fee, 1, 'Fee tokens paid');
|
|
74
|
+
equal(paid.fee_mtokens, '1000', 'Fee mtokens tokens paid');
|
|
75
|
+
equal(paid.id, invoice.id, 'Payment hash is equal on both sides');
|
|
76
|
+
equal(paid.mtokens, '101000', 'Paid mtokens');
|
|
77
|
+
equal(paid.secret, invoice.secret, 'Paid for invoice secret');
|
|
78
|
+
|
|
79
|
+
paid.hops.forEach(n => {
|
|
80
|
+
equal(n.timeout === height + 40 || n.timeout === height + 43, true);
|
|
81
|
+
|
|
82
|
+
delete n.timeout;
|
|
83
|
+
|
|
84
|
+
return;
|
|
85
|
+
});
|
|
86
|
+
|
|
87
|
+
const expectedHops = [
|
|
88
|
+
{
|
|
89
|
+
channel: channel.id,
|
|
90
|
+
channel_capacity: 1000000,
|
|
91
|
+
fee: 1,
|
|
92
|
+
fee_mtokens: '1000',
|
|
93
|
+
forward: 100,
|
|
94
|
+
forward_mtokens: invoice.mtokens,
|
|
95
|
+
public_key: target.id,
|
|
96
|
+
},
|
|
97
|
+
{
|
|
98
|
+
channel: remoteChan.id,
|
|
99
|
+
channel_capacity: 1000000,
|
|
100
|
+
fee: 0,
|
|
101
|
+
fee_mtokens: '0',
|
|
102
|
+
forward: 100,
|
|
103
|
+
forward_mtokens: '100000',
|
|
104
|
+
public_key: remote.id,
|
|
105
|
+
},
|
|
106
|
+
];
|
|
107
|
+
|
|
108
|
+
strictSame(paid.hops, expectedHops, 'Hops are returned');
|
|
109
|
+
|
|
110
|
+
const {payments} = await getInvoice({id: paid.id, lnd: remote.lnd});
|
|
111
|
+
|
|
112
|
+
if (!!payments.length) {
|
|
113
|
+
const [payment] = payments;
|
|
114
|
+
|
|
115
|
+
if (!!payment.messages.length) {
|
|
116
|
+
const [message] = payment.messages;
|
|
117
|
+
|
|
118
|
+
equal(message.type, tlvType, 'Got TLV message type');
|
|
119
|
+
equal(message.value, tlvValue, 'Got TLV message value');
|
|
120
|
+
}
|
|
111
121
|
}
|
|
122
|
+
} catch (err) {
|
|
123
|
+
equal(err, null, 'Expected no error paying payment request');
|
|
112
124
|
}
|
|
113
125
|
} catch (err) {
|
|
114
|
-
equal(err,
|
|
126
|
+
equal(err, 'Expected no errors');
|
|
127
|
+
} finally {
|
|
128
|
+
await kill({});
|
|
115
129
|
}
|
|
116
130
|
|
|
117
|
-
await kill({});
|
|
118
|
-
|
|
119
131
|
return end();
|
|
120
132
|
});
|
|
@@ -31,10 +31,12 @@ test('Probe for route', async ({end, equal, strictSame}) => {
|
|
|
31
31
|
|
|
32
32
|
const [{generate, lnd}, target, remote] = nodes;
|
|
33
33
|
|
|
34
|
-
// Send coins to remote so that it can accept a channel
|
|
35
|
-
await remote.generate({count});
|
|
36
|
-
|
|
37
34
|
try {
|
|
35
|
+
// Send coins to remote so that it can accept a channel
|
|
36
|
+
await remote.generate({count});
|
|
37
|
+
|
|
38
|
+
await addPeer({lnd, public_key: remote.id, socket: remote.socket});
|
|
39
|
+
|
|
38
40
|
await setupChannel({
|
|
39
41
|
generate,
|
|
40
42
|
lnd,
|
|
@@ -50,8 +52,6 @@ test('Probe for route', async ({end, equal, strictSame}) => {
|
|
|
50
52
|
to: remote,
|
|
51
53
|
});
|
|
52
54
|
|
|
53
|
-
await addPeer({lnd, public_key: remote.id, socket: remote.socket});
|
|
54
|
-
|
|
55
55
|
const invoice = await createInvoice({tokens, lnd: remote.lnd});
|
|
56
56
|
|
|
57
57
|
await delay(1000);
|
|
@@ -10,7 +10,6 @@ const {deleteForwardingReputations} = require('./../../');
|
|
|
10
10
|
const {getHeight} = require('./../../');
|
|
11
11
|
const {getInvoice} = require('./../../');
|
|
12
12
|
const {getPayment} = require('./../../');
|
|
13
|
-
const {getWalletVersion} = require('./../../');
|
|
14
13
|
const {payViaPaymentRequest} = require('./../../');
|
|
15
14
|
const {subscribeToForwardRequests} = require('./../../');
|
|
16
15
|
const {subscribeToPayViaRequest} = require('./../../');
|
|
@@ -17,7 +17,7 @@ const {subscribeToForwards} = require('./../../');
|
|
|
17
17
|
const anchorsFeatureBit = 23;
|
|
18
18
|
const interval = 10;
|
|
19
19
|
const size = 3;
|
|
20
|
-
const times =
|
|
20
|
+
const times = 1000;
|
|
21
21
|
const tokens = 100;
|
|
22
22
|
|
|
23
23
|
// Subscribing to forwards should show forwarding events
|
|
@@ -41,7 +41,16 @@ test('Subscribe to forwards', async ({end, equal, rejects, strictSame}) => {
|
|
|
41
41
|
to: remote,
|
|
42
42
|
});
|
|
43
43
|
|
|
44
|
-
await
|
|
44
|
+
await asyncRetry({interval, times}, async () => {
|
|
45
|
+
await addPeer({
|
|
46
|
+
lnd,
|
|
47
|
+
public_key: remote.id,
|
|
48
|
+
retry_count: 1,
|
|
49
|
+
retry_delay: 1,
|
|
50
|
+
socket: remote.socket,
|
|
51
|
+
timeout: 1000,
|
|
52
|
+
});
|
|
53
|
+
});
|
|
45
54
|
|
|
46
55
|
await delay(3000);
|
|
47
56
|
|
|
@@ -2,11 +2,8 @@ const asyncRetry = require('async/retry');
|
|
|
2
2
|
const {spawnLightningCluster} = require('ln-docker-daemons');
|
|
3
3
|
const {test} = require('@alexbosworth/tap');
|
|
4
4
|
|
|
5
|
-
const {addPeer} = require('./../../');
|
|
6
5
|
const {createInvoice} = require('./../../');
|
|
7
6
|
const {delay} = require('./../macros');
|
|
8
|
-
const {getChannels} = require('./../../');
|
|
9
|
-
const {getHeight} = require('./../../');
|
|
10
7
|
const {getPayment} = require('./../../');
|
|
11
8
|
const {payViaPaymentRequest} = require('./../../');
|
|
12
9
|
const {setupChannel} = require('./../macros');
|
|
@@ -1,12 +1,9 @@
|
|
|
1
1
|
const {test} = require('@alexbosworth/tap');
|
|
2
2
|
|
|
3
|
-
const {closeChannel} = require('./../../');
|
|
4
3
|
const {connectWatchtower} = require('./../../');
|
|
5
|
-
const {createInvoice} = require('./../../');
|
|
6
4
|
const {createCluster} = require('./../macros');
|
|
7
5
|
const {delay} = require('./../macros');
|
|
8
6
|
const {disconnectWatchtower} = require('./../../');
|
|
9
|
-
const {getChannels} = require('./../../');
|
|
10
7
|
const {getConnectedWatchtowers} = require('./../../');
|
|
11
8
|
const {getTowerServerInfo} = require('./../../');
|
|
12
9
|
const {openChannel} = require('./../../');
|