ln-service 52.13.0 → 52.14.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 CHANGED
@@ -1,5 +1,10 @@
1
1
  # Versions
2
2
 
3
+ ## 52.14.3
4
+
5
+ - `probeForRoute`, `subscribeToProbeForRoute`, `subscribeToPayViaRoutes`,
6
+ `payViaRoutes`: When probing (no hash), delete the payment failure record after the probe
7
+
3
8
  ## 52.13.0
4
9
 
5
10
  - Add method `sendMessageToPeer` to send a custom peer message
package/package.json CHANGED
@@ -7,11 +7,11 @@
7
7
  "url": "https://github.com/alexbosworth/ln-service/issues"
8
8
  },
9
9
  "dependencies": {
10
- "bolt07": "1.7.3",
10
+ "bolt07": "1.7.4",
11
11
  "cors": "2.8.5",
12
12
  "express": "4.17.1",
13
- "invoices": "2.0.0",
14
- "lightning": "4.11.1",
13
+ "invoices": "2.0.1",
14
+ "lightning": "4.13.1",
15
15
  "macaroon": "3.0.4",
16
16
  "morgan": "1.10.0",
17
17
  "ws": "8.2.3"
@@ -20,8 +20,8 @@
20
20
  "devDependencies": {
21
21
  "@alexbosworth/tap": "15.0.10",
22
22
  "@alexbosworth/node-fetch": "2.6.2",
23
- "async": "3.2.1",
24
- "asyncjs-util": "1.2.6",
23
+ "async": "3.2.2",
24
+ "asyncjs-util": "1.2.7",
25
25
  "bip66": "1.1.5",
26
26
  "bitcoinjs-lib": "5.2.0",
27
27
  "bn.js": "5.2.0",
@@ -61,5 +61,5 @@
61
61
  "tower_server-integration-tests": "tap --no-coverage test/tower_serverrpc-integration/*.js",
62
62
  "wallet-integration-tests": "tap --no-coverage test/walletrpc-integration/*.js"
63
63
  },
64
- "version": "52.13.0"
64
+ "version": "52.14.3"
65
65
  }
@@ -9,8 +9,7 @@ const {deleteForwardingReputations} = require('./../../');
9
9
  const {getFailedPayments} = require('./../../');
10
10
  const {getPayment} = require('./../../');
11
11
  const {getPayments} = require('./../../');
12
- const {payViaRoutes} = require('./../../');
13
- const {probeForRoute} = require('./../../');
12
+ const {pay} = require('./../../');
14
13
  const {sendToChainAddress} = require('./../../');
15
14
  const {setupChannel} = require('./../macros');
16
15
 
@@ -59,21 +58,16 @@ test('Get failed payments', async ({end, equal, strictSame}) => {
59
58
 
60
59
  const invoice = await createInvoice({tokens, lnd: cluster.remote.lnd});
61
60
 
61
+ const bigInvoice = await createInvoice({
62
+ tokens: (channelCapacityTokens / 2) + (channelCapacityTokens / 4),
63
+ lnd: cluster.remote.lnd,
64
+ });
65
+
62
66
  await delay(1000);
63
67
 
64
68
  try {
65
- await probeForRoute({
66
- lnd,
67
- destination: cluster.remote_node_public_key,
68
- is_ignoring_past_failures: true,
69
- tokens: invoice.tokens,
70
- });
69
+ await pay({lnd, request: bigInvoice.request});
71
70
  } catch (err) {
72
- const [code, message, {failure}] = err;
73
-
74
- equal(code, 503, 'Failed to find route');
75
- equal(message, 'RoutingFailure', 'Hit a routing failure');
76
- equal(failure.reason, 'TemporaryChannelFailure', 'Temporary failure');
77
71
  }
78
72
 
79
73
  // Create a new channel to increase total edge liquidity
@@ -88,32 +82,7 @@ test('Get failed payments', async ({end, equal, strictSame}) => {
88
82
  await deleteForwardingReputations({lnd});
89
83
 
90
84
  try {
91
- const {route} = await probeForRoute({
92
- lnd,
93
- destination: cluster.remote.public_key,
94
- payment: invoice.payment,
95
- tokens: invoice.tokens,
96
- total_mtokens: !!invoice.payment ? invoice.mtokens : undefined,
97
- });
98
-
99
- if (!route) {
100
- throw new Error('ExpectedRouteFromProbe');
101
- }
102
-
103
- equal(route.fee, 1, 'Found route fee');
104
- equal(route.fee_mtokens, '1500', 'Found route fee mtokens');
105
- strictSame(route.hops.length, 2, 'Found route hops returned');
106
- equal(route.mtokens, '500001500', 'Found route mtokens');
107
- equal(route.timeout, 586, 'Found route timeout');
108
- equal(route.tokens, 500001, 'Found route tokens');
109
-
110
- const {secret} = await payViaRoutes({
111
- lnd,
112
- id: invoice.id,
113
- routes: [route],
114
- });
115
-
116
- equal(secret, invoice.secret, 'Route works');
85
+ const {secret} = await pay({lnd, request: invoice.request});
117
86
  } catch (err) {
118
87
  equal(err, null, 'No error when probing for route');
119
88
  }
@@ -128,17 +97,16 @@ test('Get failed payments', async ({end, equal, strictSame}) => {
128
97
  equal(!!payment.created_at, true, 'Got payment created date');
129
98
  equal(payment.fee, undefined, 'No fee when not paid');
130
99
  equal(payment.fee_mtokens, undefined, 'No fee mtokens when not paid');
131
- strictSame(payment.hops, [cluster.target.public_key], 'Got hops');
132
100
  equal(!!payment.id, true, 'Got a payment id');
133
101
  equal(!!payment.index, true, 'Got payment index');
134
102
  equal(payment.is_confirmed, false, 'Failed payment is not confirmed');
135
103
  equal(payment.is_outgoing, true, 'Failed payment is outgoing');
136
- equal(payment.mtokens, invoice.mtokens, 'Payment has mtokens');
137
- equal(payment.request, undefined, 'Probe has no request');
104
+ equal(payment.mtokens, bigInvoice.mtokens, 'Payment has mtokens');
105
+ equal(payment.request, bigInvoice.request, 'Probe has a request');
138
106
  equal(payment.secret, undefined, 'Failed has no secret');
139
107
  equal(payment.safe_fee, undefined, 'Failed has no fee');
140
- equal(payment.safe_tokens, invoice.tokens, 'Failed has safe tokens');
141
- equal(payment.tokens, invoice.tokens, 'Failed has tokens');
108
+ equal(payment.safe_tokens, bigInvoice.tokens, 'Failed has safe tokens');
109
+ equal(payment.tokens, bigInvoice.tokens, 'Failed has tokens');
142
110
 
143
111
  const gotFailed = await getPayment({lnd, id: payment.id});
144
112
 
@@ -147,9 +115,9 @@ test('Get failed payments', async ({end, equal, strictSame}) => {
147
115
  {
148
116
  failed: {
149
117
  is_insufficient_balance: false,
150
- is_invalid_payment: true,
118
+ is_invalid_payment: false,
151
119
  is_pathfinding_timeout: false,
152
- is_route_not_found: false,
120
+ is_route_not_found: true,
153
121
  },
154
122
  is_confirmed: false,
155
123
  is_failed: true,
@@ -176,7 +144,7 @@ test('Get failed payments', async ({end, equal, strictSame}) => {
176
144
  equal(payment.is_confirmed, true, 'Failed payment is not confirmed');
177
145
  equal(payment.is_outgoing, true, 'Failed payment is outgoing');
178
146
  equal(payment.mtokens, invoice.mtokens, 'Payment has mtokens');
179
- equal(payment.request, undefined, 'Probed payment has no request');
147
+ equal(payment.request, invoice.request, 'Payment has a request');
180
148
  equal(!!payment.secret, true, 'Failed has no secret');
181
149
  equal(payment.safe_fee, 2, 'Failed has no fee');
182
150
  equal(payment.safe_tokens, invoice.tokens, 'Failed has safe tokens');
@@ -6,6 +6,8 @@ const {createCluster} = require('./../macros');
6
6
  const {createInvoice} = require('./../../');
7
7
  const {delay} = require('./../macros');
8
8
  const {deleteForwardingReputations} = require('./../../');
9
+ const {getFailedPayments} = require('./../../');
10
+ const {getWalletVersion} = require('./../../');
9
11
  const {payViaRoutes} = require('./../../');
10
12
  const {probeForRoute} = require('./../../');
11
13
  const {sendToChainAddress} = require('./../../');
@@ -75,6 +77,16 @@ test('Probe for route', async ({end, equal, strictSame}) => {
75
77
  equal(failure.reason, 'TemporaryChannelFailure', 'Temporary failure');
76
78
  }
77
79
 
80
+ const {version} = await getWalletVersion({lnd});
81
+
82
+ const [, minor] = (version || '').split('.');
83
+
84
+ if (!version || parseInt(minor) > 13) {
85
+ const {payments} = await getFailedPayments({lnd});
86
+
87
+ strictSame(payments, [], 'Probes do not leave a failed state behind');
88
+ }
89
+
78
90
  // Create a new channel to increase total edge liquidity
79
91
  await setupChannel({
80
92
  capacity: channelCapacityTokens,