ln-service 53.7.0 → 53.8.0

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.
Files changed (41) hide show
  1. package/CHANGELOG.md +5 -1
  2. package/README.md +38 -2
  3. package/index.js +4 -2
  4. package/package.json +9 -6
  5. package/test/integration/test_add_peer.js +4 -2
  6. package/test/integration/test_delete_pending_channel.js +5 -2
  7. package/test/integration/test_get_closed_channels.js +0 -2
  8. package/test/integration/test_get_invoice.js +0 -1
  9. package/test/integration/test_get_node.js +13 -1
  10. package/test/integration/test_get_peers.js +32 -21
  11. package/test/integration/test_get_pending_force.js +1 -1
  12. package/test/integration/test_get_wallet_info.js +32 -26
  13. package/test/integration/test_open_channels.js +22 -15
  14. package/test/integration/test_pay.js +0 -1
  15. package/test/integration/test_pay_private_invoice.js +0 -1
  16. package/test/integration/test_propose_channel.js +438 -421
  17. package/test/integration/test_remove_peer.js +13 -9
  18. package/test/integration/test_send_message_to_peer.js +39 -28
  19. package/test/integration/test_send_to_chain_address.js +4 -0
  20. package/test/integration/test_subscribe_to_channels.js +0 -1
  21. package/test/integration/test_subscribe_to_invoices.js +80 -78
  22. package/test/integration/test_subscribe_to_peer_messages.js +6 -4
  23. package/test/integration/test_subscribe_to_peers.js +23 -19
  24. package/test/invoicesrpc-integration/test_get_sweep_transactions.js +0 -2
  25. package/test/invoicesrpc-integration/test_subscribe_cancel_invoice.js +0 -1
  26. package/test/macros/wait_for_channel.js +1 -1
  27. package/test/routerrpc-integration/test_delete_forwarding_reputations.js +61 -27
  28. package/test/routerrpc-integration/test_get_forwarding_reputations.js +42 -14
  29. package/test/routerrpc-integration/test_get_route_through_hops.js +33 -22
  30. package/test/routerrpc-integration/test_multipath_payment.js +0 -1
  31. package/test/routerrpc-integration/test_pay_via_payment_details.js +118 -111
  32. package/test/routerrpc-integration/test_pay_via_payment_request.js +92 -80
  33. package/test/routerrpc-integration/test_probe_for_route.js +78 -74
  34. package/test/routerrpc-integration/test_subscribe_to_forward_requests.js +0 -1
  35. package/test/routerrpc-integration/test_subscribe_to_forwards.js +518 -505
  36. package/test/routerrpc-integration/test_subscribe_to_past_payments.js +0 -3
  37. package/test/tower_clientrpc-integration/test_get_connected_watchtowers.js +0 -3
  38. package/test/walletrpc-integration/test_fund_psbt.js +113 -1
  39. package/test/walletrpc-integration/test_get_master_public_keys.js +79 -0
  40. package/test/walletrpc-integration/test_partially_sign_psbt.js +17 -5
  41. 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
- // Send coins to remote so that it can accept a channel
35
- await remote.generate({count});
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
- await delay(1000);
38
+ await addPeer({lnd, public_key: remote.id, socket: remote.socket});
57
39
 
58
- try {
59
- await probeForRoute({
40
+ await setupChannel({
41
+ generate,
60
42
  lnd,
61
- destination: remote.id,
62
- is_ignoring_past_failures: true,
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
- equal(code, 503, 'Failed to find route');
69
- equal(message, 'RoutingFailure', 'Hit a routing failure');
70
- equal(failure.reason, 'TemporaryChannelFailure', 'Temporary failure');
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
- const {version} = await getWalletVersion({lnd});
55
+ const invoice = await createInvoice({tokens, lnd: remote.lnd});
74
56
 
75
- const [, minor] = (version || '').split('.');
57
+ await delay(1000);
76
58
 
77
- if (!version || parseInt(minor) > 13) {
78
- const {payments} = await getFailedPayments({lnd});
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
- strictSame(payments, [], 'Probes do not leave a failed state behind');
81
- }
82
-
83
- // Create a new channel to increase total edge liquidity
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
- await deleteForwardingReputations({lnd});
74
+ const {version} = await getWalletVersion({lnd});
92
75
 
93
- await waitForRoute({lnd, destination: remote.id, tokens: invoice.tokens});
76
+ const [, minor] = (version || '').split('.');
94
77
 
95
- try {
96
- const {route} = await probeForRoute({
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
- if (!route) {
105
- throw new Error('ExpectedRouteFromProbe');
81
+ strictSame(payments, [], 'Probes do not leave a failed state behind');
106
82
  }
107
83
 
108
- equal(route.fee, 1, 'Found route fee');
109
- equal(route.fee_mtokens, '1500', 'Found route fee mtokens');
110
- strictSame(route.hops.length, 2, 'Found route hops returned');
111
- equal(route.mtokens, '500001500', 'Found route mtokens');
112
- equal(route.timeout >= 400, true, 'Found route timeout');
113
- equal(route.tokens, 500001, 'Found route tokens');
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
- equal(secret, invoice.secret, 'Route works');
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, 'No error when probing for route');
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('./../../');