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
|
@@ -31,99 +31,103 @@ test('Probe for route', async ({end, equal, strictSame}) => {
|
|
|
31
31
|
|
|
32
32
|
const [{generate, lnd}, target, remote] = nodes;
|
|
33
33
|
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
await setupChannel({
|
|
38
|
-
generate,
|
|
39
|
-
lnd,
|
|
40
|
-
capacity: channelCapacityTokens + channelCapacityTokens,
|
|
41
|
-
to: target,
|
|
42
|
-
});
|
|
43
|
-
|
|
44
|
-
await setupChannel({
|
|
45
|
-
capacity: channelCapacityTokens,
|
|
46
|
-
lnd: target.lnd,
|
|
47
|
-
generate: target.generate,
|
|
48
|
-
give: Math.round(channelCapacityTokens / 2),
|
|
49
|
-
to: remote,
|
|
50
|
-
});
|
|
51
|
-
|
|
52
|
-
await addPeer({lnd, public_key: remote.id, socket: remote.socket});
|
|
53
|
-
|
|
54
|
-
const invoice = await createInvoice({tokens, lnd: remote.lnd});
|
|
34
|
+
try {
|
|
35
|
+
// Send coins to remote so that it can accept a channel
|
|
36
|
+
await remote.generate({count});
|
|
55
37
|
|
|
56
|
-
|
|
38
|
+
await addPeer({lnd, public_key: remote.id, socket: remote.socket});
|
|
57
39
|
|
|
58
|
-
|
|
59
|
-
|
|
40
|
+
await setupChannel({
|
|
41
|
+
generate,
|
|
60
42
|
lnd,
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
tokens: invoice.tokens,
|
|
43
|
+
capacity: channelCapacityTokens + channelCapacityTokens,
|
|
44
|
+
to: target,
|
|
64
45
|
});
|
|
65
|
-
} catch (err) {
|
|
66
|
-
const [code, message, {failure}] = err;
|
|
67
46
|
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
47
|
+
await setupChannel({
|
|
48
|
+
capacity: channelCapacityTokens,
|
|
49
|
+
lnd: target.lnd,
|
|
50
|
+
generate: target.generate,
|
|
51
|
+
give: Math.round(channelCapacityTokens / 2),
|
|
52
|
+
to: remote,
|
|
53
|
+
});
|
|
72
54
|
|
|
73
|
-
|
|
55
|
+
const invoice = await createInvoice({tokens, lnd: remote.lnd});
|
|
74
56
|
|
|
75
|
-
|
|
57
|
+
await delay(1000);
|
|
76
58
|
|
|
77
|
-
|
|
78
|
-
|
|
59
|
+
try {
|
|
60
|
+
await probeForRoute({
|
|
61
|
+
lnd,
|
|
62
|
+
destination: remote.id,
|
|
63
|
+
is_ignoring_past_failures: true,
|
|
64
|
+
tokens: invoice.tokens,
|
|
65
|
+
});
|
|
66
|
+
} catch (err) {
|
|
67
|
+
const [code, message, {failure}] = err;
|
|
79
68
|
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
await setupChannel({
|
|
85
|
-
capacity: channelCapacityTokens,
|
|
86
|
-
lnd: target.lnd,
|
|
87
|
-
generate: target.generate,
|
|
88
|
-
to: remote,
|
|
89
|
-
});
|
|
69
|
+
equal(code, 503, 'Failed to find route');
|
|
70
|
+
equal(message, 'RoutingFailure', 'Hit a routing failure');
|
|
71
|
+
equal(failure.reason, 'TemporaryChannelFailure', 'Temporary failure');
|
|
72
|
+
}
|
|
90
73
|
|
|
91
|
-
|
|
74
|
+
const {version} = await getWalletVersion({lnd});
|
|
92
75
|
|
|
93
|
-
|
|
76
|
+
const [, minor] = (version || '').split('.');
|
|
94
77
|
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
lnd,
|
|
98
|
-
destination: remote.id,
|
|
99
|
-
payment: invoice.payment,
|
|
100
|
-
tokens: invoice.tokens,
|
|
101
|
-
total_mtokens: !!invoice.payment ? invoice.mtokens : undefined,
|
|
102
|
-
});
|
|
78
|
+
if (!version || parseInt(minor) > 13) {
|
|
79
|
+
const {payments} = await getFailedPayments({lnd});
|
|
103
80
|
|
|
104
|
-
|
|
105
|
-
throw new Error('ExpectedRouteFromProbe');
|
|
81
|
+
strictSame(payments, [], 'Probes do not leave a failed state behind');
|
|
106
82
|
}
|
|
107
83
|
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
const {secret} = await payViaRoutes({
|
|
116
|
-
lnd,
|
|
117
|
-
id: invoice.id,
|
|
118
|
-
routes: [route],
|
|
84
|
+
// Create a new channel to increase total edge liquidity
|
|
85
|
+
await setupChannel({
|
|
86
|
+
capacity: channelCapacityTokens,
|
|
87
|
+
lnd: target.lnd,
|
|
88
|
+
generate: target.generate,
|
|
89
|
+
to: remote,
|
|
119
90
|
});
|
|
120
91
|
|
|
121
|
-
|
|
92
|
+
await deleteForwardingReputations({lnd});
|
|
93
|
+
|
|
94
|
+
await waitForRoute({lnd, destination: remote.id, tokens: invoice.tokens});
|
|
95
|
+
|
|
96
|
+
try {
|
|
97
|
+
const {route} = await probeForRoute({
|
|
98
|
+
lnd,
|
|
99
|
+
destination: remote.id,
|
|
100
|
+
payment: invoice.payment,
|
|
101
|
+
tokens: invoice.tokens,
|
|
102
|
+
total_mtokens: !!invoice.payment ? invoice.mtokens : undefined,
|
|
103
|
+
});
|
|
104
|
+
|
|
105
|
+
if (!route) {
|
|
106
|
+
throw new Error('ExpectedRouteFromProbe');
|
|
107
|
+
}
|
|
108
|
+
|
|
109
|
+
equal(route.fee, 1, 'Found route fee');
|
|
110
|
+
equal(route.fee_mtokens, '1500', 'Found route fee mtokens');
|
|
111
|
+
strictSame(route.hops.length, 2, 'Found route hops returned');
|
|
112
|
+
equal(route.mtokens, '500001500', 'Found route mtokens');
|
|
113
|
+
equal(route.timeout >= 400, true, 'Found route timeout');
|
|
114
|
+
equal(route.tokens, 500001, 'Found route tokens');
|
|
115
|
+
|
|
116
|
+
const {secret} = await payViaRoutes({
|
|
117
|
+
lnd,
|
|
118
|
+
id: invoice.id,
|
|
119
|
+
routes: [route],
|
|
120
|
+
});
|
|
121
|
+
|
|
122
|
+
equal(secret, invoice.secret, 'Route works');
|
|
123
|
+
} catch (err) {
|
|
124
|
+
equal(err, null, 'No error when probing for route');
|
|
125
|
+
}
|
|
122
126
|
} catch (err) {
|
|
123
|
-
equal(err, null, '
|
|
127
|
+
equal(err, null, 'Expected no error');
|
|
128
|
+
} finally {
|
|
129
|
+
await kill({});
|
|
124
130
|
}
|
|
125
131
|
|
|
126
|
-
await kill({});
|
|
127
|
-
|
|
128
132
|
return end();
|
|
129
133
|
});
|
|
@@ -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('./../../');
|
|
@@ -20,8 +19,8 @@ const {waitForRoute} = require('./../macros');
|
|
|
20
19
|
const size = 3;
|
|
21
20
|
const tokens = 100;
|
|
22
21
|
|
|
23
|
-
//
|
|
24
|
-
test(`
|
|
22
|
+
// Subscribing to forward requests should intercept forwards
|
|
23
|
+
test(`Subscribe to requests`, async ({end, equal, rejects, strictSame}) => {
|
|
25
24
|
const {kill, nodes} = await spawnLightningCluster({size});
|
|
26
25
|
|
|
27
26
|
const [{generate, lnd}, target, remote] = nodes;
|