probing 3.0.1 → 4.0.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.
- package/CHANGELOG.md +4 -0
- package/package.json +6 -9
- package/test/graph/test_get_policies_for_channels.js +5 -3
- package/test/graph/test_max_htlc_across_route.js +4 -2
- package/test/liquidity/test_find_max_payable.js +7 -5
- package/test/liquidity/test_get_synthetic_out_ignores.js +5 -3
- package/test/liquidity/test_hops_for_find_max_path.js +4 -2
- package/test/liquidity/test_multi_probe_ignores.js +4 -2
- package/test/liquidity/test_subscribe_to_find_max_payable.js +5 -4
- package/test/liquidity/test_subscribe_to_find_path.js +4 -5
- package/test/liquidity/test_subscribe_to_multi_path_probe.js +5 -4
- package/test/payments/test_get_route_for_payment.js +5 -3
- package/test/payments/test_mtokens_for_multi_path_payment.js +5 -3
- package/test/payments/test_sort_multiple_payment_paths.js +4 -2
- package/test/payments/test_subscribe_to_multi_path_pay.js +6 -5
- package/test/routing/test_channels_from_hints.js +4 -2
- package/test/routing/test_is_route_payable.js +7 -6
package/CHANGELOG.md
CHANGED
package/package.json
CHANGED
|
@@ -8,16 +8,13 @@
|
|
|
8
8
|
},
|
|
9
9
|
"dependencies": {
|
|
10
10
|
"async": "3.2.4",
|
|
11
|
-
"asyncjs-util": "1.2.
|
|
12
|
-
"bolt07": "1.8.
|
|
13
|
-
"ln-service": "
|
|
11
|
+
"asyncjs-util": "1.2.12",
|
|
12
|
+
"bolt07": "1.8.4",
|
|
13
|
+
"ln-service": "56.7.1"
|
|
14
14
|
},
|
|
15
15
|
"description": "Lightning Network probing utilities",
|
|
16
|
-
"devDependencies": {
|
|
17
|
-
"@alexbosworth/tap": "15.0.12"
|
|
18
|
-
},
|
|
19
16
|
"engines": {
|
|
20
|
-
"node": ">=
|
|
17
|
+
"node": ">=16"
|
|
21
18
|
},
|
|
22
19
|
"keywords": [
|
|
23
20
|
"lightning",
|
|
@@ -32,7 +29,7 @@
|
|
|
32
29
|
"url": "https://github.com/alexbosworth/probing.git"
|
|
33
30
|
},
|
|
34
31
|
"scripts": {
|
|
35
|
-
"test": "
|
|
32
|
+
"test": "npx nyc@15.1 node --experimental-test-coverage --test"
|
|
36
33
|
},
|
|
37
|
-
"version": "
|
|
34
|
+
"version": "4.0.0"
|
|
38
35
|
}
|
|
@@ -1,4 +1,6 @@
|
|
|
1
|
-
const {
|
|
1
|
+
const {rejects} = require('node:assert').strict;
|
|
2
|
+
const strictSame = require('node:assert').strict.deepStrictEqual;
|
|
3
|
+
const test = require('node:test');
|
|
2
4
|
|
|
3
5
|
const {channels} = require('./../fixtures/hop_hints');
|
|
4
6
|
const {getPoliciesForChannels} = require('./../../graph');
|
|
@@ -182,7 +184,7 @@ const tests = [
|
|
|
182
184
|
];
|
|
183
185
|
|
|
184
186
|
tests.forEach(({args, description, error, expected}) => {
|
|
185
|
-
return test(description, async (
|
|
187
|
+
return test(description, async () => {
|
|
186
188
|
if (!!error) {
|
|
187
189
|
await rejects(getPoliciesForChannels(args), error, 'Got expected error');
|
|
188
190
|
} else {
|
|
@@ -191,6 +193,6 @@ tests.forEach(({args, description, error, expected}) => {
|
|
|
191
193
|
strictSame(channels, expected.channels, 'Got expected channels');
|
|
192
194
|
}
|
|
193
195
|
|
|
194
|
-
return
|
|
196
|
+
return;
|
|
195
197
|
});
|
|
196
198
|
});
|
|
@@ -1,4 +1,6 @@
|
|
|
1
|
-
const
|
|
1
|
+
const strictSame = require('node:assert').strict.deepStrictEqual;
|
|
2
|
+
const test = require('node:test');
|
|
3
|
+
const {throws} = require('node:assert').strict;
|
|
2
4
|
|
|
3
5
|
const {maxHtlcAcrossRoute} = require('./../../graph');
|
|
4
6
|
|
|
@@ -73,7 +75,7 @@ const tests = [
|
|
|
73
75
|
];
|
|
74
76
|
|
|
75
77
|
tests.forEach(({args, description, error, expected}) => {
|
|
76
|
-
return test(description,
|
|
78
|
+
return test(description, (t, end) => {
|
|
77
79
|
if (!!error) {
|
|
78
80
|
throws(() => maxHtlcAcrossRoute(args), error, 'Got expected error');
|
|
79
81
|
} else {
|
|
@@ -1,4 +1,6 @@
|
|
|
1
|
-
const {
|
|
1
|
+
const {rejects} = require('node:assert').strict;
|
|
2
|
+
const strictSame = require('node:assert').strict.deepStrictEqual;
|
|
3
|
+
const test = require('node:test');
|
|
2
4
|
|
|
3
5
|
const findMaxPayable = require('./../../liquidity/find_max_payable');
|
|
4
6
|
const {getInfoResponse} = require('./../fixtures');
|
|
@@ -208,19 +210,19 @@ const tests = [
|
|
|
208
210
|
];
|
|
209
211
|
|
|
210
212
|
tests.forEach(({args, description, error, expected}) => {
|
|
211
|
-
return test(description, async (
|
|
213
|
+
return test(description, async () => {
|
|
212
214
|
if (!!error) {
|
|
213
215
|
await rejects(findMaxPayable(args), error, 'Got expected error');
|
|
214
216
|
} else if (expected.maximum) {
|
|
215
217
|
const {maximum} = await findMaxPayable(args);
|
|
216
218
|
|
|
217
|
-
|
|
219
|
+
strictSame(maximum > expected.maximum - 100000, true, 'Got maximum');
|
|
218
220
|
} else {
|
|
219
221
|
const {maximum} = await findMaxPayable(args);
|
|
220
222
|
|
|
221
|
-
|
|
223
|
+
strictSame(maximum, Number(), 'Max payable is zero');
|
|
222
224
|
}
|
|
223
225
|
|
|
224
|
-
return
|
|
226
|
+
return;
|
|
225
227
|
});
|
|
226
228
|
});
|
|
@@ -1,4 +1,6 @@
|
|
|
1
|
-
const {
|
|
1
|
+
const {rejects} = require('node:assert').strict;
|
|
2
|
+
const strictSame = require('node:assert').strict.deepStrictEqual;
|
|
3
|
+
const test = require('node:test');
|
|
2
4
|
|
|
3
5
|
const {getInfoResponse} = require('./../fixtures');
|
|
4
6
|
const {getSyntheticOutIgnores} = require('./../../');
|
|
@@ -100,7 +102,7 @@ const tests = [
|
|
|
100
102
|
];
|
|
101
103
|
|
|
102
104
|
tests.forEach(({args, description, error, expected}) => {
|
|
103
|
-
return test(description, async (
|
|
105
|
+
return test(description, async () => {
|
|
104
106
|
if (!!error) {
|
|
105
107
|
await rejects(getSyntheticOutIgnores(args), error, 'Got expected error');
|
|
106
108
|
} else {
|
|
@@ -109,6 +111,6 @@ tests.forEach(({args, description, error, expected}) => {
|
|
|
109
111
|
strictSame(ignore, expected.ignore, 'Got expected ignores');
|
|
110
112
|
}
|
|
111
113
|
|
|
112
|
-
return
|
|
114
|
+
return;
|
|
113
115
|
});
|
|
114
116
|
});
|
|
@@ -1,4 +1,6 @@
|
|
|
1
|
-
const
|
|
1
|
+
const strictSame = require('node:assert').strict.deepStrictEqual;
|
|
2
|
+
const test = require('node:test');
|
|
3
|
+
const {throws} = require('node:assert').strict;
|
|
2
4
|
|
|
3
5
|
const hopsForFindMaxPath = require('./../../liquidity/hops_for_find_max_path');
|
|
4
6
|
|
|
@@ -94,7 +96,7 @@ const tests = [
|
|
|
94
96
|
];
|
|
95
97
|
|
|
96
98
|
tests.forEach(({args, description, error, expected}) => {
|
|
97
|
-
return test(description,
|
|
99
|
+
return test(description, (t, end) => {
|
|
98
100
|
if (!!error) {
|
|
99
101
|
throws(() => hopsForFindMaxPath(args), new Error(error), 'Got error');
|
|
100
102
|
} else {
|
|
@@ -1,4 +1,6 @@
|
|
|
1
|
-
const
|
|
1
|
+
const strictSame = require('node:assert').strict.deepStrictEqual;
|
|
2
|
+
const test = require('node:test');
|
|
3
|
+
const {throws} = require('node:assert').strict;
|
|
2
4
|
|
|
3
5
|
const multiProbeIgnores = require('./../../liquidity/multi_probe_ignores');
|
|
4
6
|
|
|
@@ -265,7 +267,7 @@ const tests = [
|
|
|
265
267
|
];
|
|
266
268
|
|
|
267
269
|
tests.forEach(({args, description, error, expected}) => {
|
|
268
|
-
return test(description,
|
|
270
|
+
return test(description, (t, end) => {
|
|
269
271
|
if (!!error) {
|
|
270
272
|
throws(() => multiProbeIgnores(args), new Error(error), 'Got error');
|
|
271
273
|
} else {
|
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
const {once} = require('events');
|
|
2
2
|
const {promisify} = require('util');
|
|
3
|
-
|
|
4
|
-
const
|
|
3
|
+
const strictSame = require('node:assert').strict.deepStrictEqual;
|
|
4
|
+
const test = require('node:test');
|
|
5
|
+
const {throws} = require('node:assert').strict;
|
|
5
6
|
|
|
6
7
|
const {getChanInfoResponse} = require('./../fixtures');
|
|
7
8
|
const {getInfoResponse} = require('./../fixtures');
|
|
@@ -77,7 +78,7 @@ const tests = [
|
|
|
77
78
|
];
|
|
78
79
|
|
|
79
80
|
tests.forEach(({args, description, error, expected}) => {
|
|
80
|
-
return test(description, async (
|
|
81
|
+
return test(description, async () => {
|
|
81
82
|
if (!!error) {
|
|
82
83
|
throws(() => subscribeToFindMaxPayable(args), error, 'Got error');
|
|
83
84
|
} else {
|
|
@@ -102,6 +103,6 @@ tests.forEach(({args, description, error, expected}) => {
|
|
|
102
103
|
strictSame(events, expected.events, 'Got expected events');
|
|
103
104
|
}
|
|
104
105
|
|
|
105
|
-
return
|
|
106
|
+
return;
|
|
106
107
|
});
|
|
107
108
|
});
|
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
const {once} = require('events');
|
|
2
2
|
const {promisify} = require('util');
|
|
3
|
-
|
|
4
|
-
const
|
|
3
|
+
const strictSame = require('node:assert').strict.deepStrictEqual;
|
|
4
|
+
const test = require('node:test');
|
|
5
|
+
const {throws} = require('node:assert').strict;
|
|
5
6
|
|
|
6
7
|
const {getChanInfoResponse} = require('./../fixtures');
|
|
7
8
|
const {getInfoResponse} = require('./../fixtures');
|
|
@@ -451,7 +452,7 @@ const tests = [
|
|
|
451
452
|
];
|
|
452
453
|
|
|
453
454
|
tests.forEach(({args, description, error, expected}) => {
|
|
454
|
-
return test(description, async (
|
|
455
|
+
return test(description, async () => {
|
|
455
456
|
if (!!error) {
|
|
456
457
|
throws(() => method(args), error, 'Got error');
|
|
457
458
|
} else {
|
|
@@ -478,7 +479,5 @@ tests.forEach(({args, description, error, expected}) => {
|
|
|
478
479
|
|
|
479
480
|
strictSame(events, expected.events, 'Got expected events');
|
|
480
481
|
}
|
|
481
|
-
|
|
482
|
-
return end();
|
|
483
482
|
});
|
|
484
483
|
});
|
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
const {once} = require('events');
|
|
2
2
|
const {promisify} = require('util');
|
|
3
|
-
|
|
4
|
-
const
|
|
3
|
+
const strictSame = require('node:assert').strict.deepStrictEqual;
|
|
4
|
+
const test = require('node:test');
|
|
5
|
+
const {throws} = require('node:assert').strict;
|
|
5
6
|
|
|
6
7
|
const {getChanInfoResponse} = require('./../fixtures');
|
|
7
8
|
const {getInfoResponse} = require('./../fixtures');
|
|
@@ -325,7 +326,7 @@ const tests = [
|
|
|
325
326
|
];
|
|
326
327
|
|
|
327
328
|
tests.forEach(({args, description, error, expected}) => {
|
|
328
|
-
return test(description, async (
|
|
329
|
+
return test(description, async () => {
|
|
329
330
|
if (!!error) {
|
|
330
331
|
throws(() => subscribeToMultiPathProbe(args), error, 'Got error');
|
|
331
332
|
} else {
|
|
@@ -353,6 +354,6 @@ tests.forEach(({args, description, error, expected}) => {
|
|
|
353
354
|
strictSame(events, expected.events, 'Got expected events');
|
|
354
355
|
}
|
|
355
356
|
|
|
356
|
-
return
|
|
357
|
+
return;
|
|
357
358
|
});
|
|
358
359
|
});
|
|
@@ -1,4 +1,6 @@
|
|
|
1
|
-
const {
|
|
1
|
+
const {rejects} = require('node:assert').strict;
|
|
2
|
+
const strictSame = require('node:assert').strict.deepStrictEqual;
|
|
3
|
+
const test = require('node:test');
|
|
2
4
|
|
|
3
5
|
const {getChanInfoResponse} = require('./../fixtures');
|
|
4
6
|
const {getInfoResponse} = require('./../fixtures');
|
|
@@ -158,7 +160,7 @@ const tests = [
|
|
|
158
160
|
];
|
|
159
161
|
|
|
160
162
|
tests.forEach(({args, description, error, expected}) => {
|
|
161
|
-
return test(description, async (
|
|
163
|
+
return test(description, async () => {
|
|
162
164
|
if (!!error) {
|
|
163
165
|
await rejects(getRouteForPayment(args), error, 'Got expected error');
|
|
164
166
|
} else {
|
|
@@ -167,6 +169,6 @@ tests.forEach(({args, description, error, expected}) => {
|
|
|
167
169
|
strictSame(route, expected, 'Got expected route');
|
|
168
170
|
}
|
|
169
171
|
|
|
170
|
-
return
|
|
172
|
+
return;
|
|
171
173
|
});
|
|
172
174
|
});
|
|
@@ -1,4 +1,6 @@
|
|
|
1
|
-
const
|
|
1
|
+
const strictSame = require('node:assert').strict.deepStrictEqual;
|
|
2
|
+
const test = require('node:test');
|
|
3
|
+
const {throws} = require('node:assert').strict;
|
|
2
4
|
|
|
3
5
|
const method = require('./../../payments/mtokens_for_multi_path_payment');
|
|
4
6
|
|
|
@@ -59,13 +61,13 @@ const tests = [
|
|
|
59
61
|
];
|
|
60
62
|
|
|
61
63
|
tests.forEach(({args, description, error, expected}) => {
|
|
62
|
-
return test(description,
|
|
64
|
+
return test(description, (t, end) => {
|
|
63
65
|
if (!!error) {
|
|
64
66
|
throws(() => method(args), error, 'Got expected error');
|
|
65
67
|
} else {
|
|
66
68
|
const {sorted} = method(args);
|
|
67
69
|
|
|
68
|
-
strictSame(sorted, expected.sorted);
|
|
70
|
+
strictSame(sorted, expected.sorted, 'Got expected result');
|
|
69
71
|
}
|
|
70
72
|
|
|
71
73
|
return end();
|
|
@@ -1,4 +1,6 @@
|
|
|
1
|
-
const
|
|
1
|
+
const strictSame = require('node:assert').strict.deepStrictEqual;
|
|
2
|
+
const test = require('node:test');
|
|
3
|
+
const {throws} = require('node:assert').strict;
|
|
2
4
|
|
|
3
5
|
const method = require('./../../payments/sort_multiple_payment_paths');
|
|
4
6
|
|
|
@@ -75,7 +77,7 @@ const tests = [
|
|
|
75
77
|
];
|
|
76
78
|
|
|
77
79
|
tests.forEach(({args, description, error, expected}) => {
|
|
78
|
-
return test(description,
|
|
80
|
+
return test(description, (t, end) => {
|
|
79
81
|
if (!!error) {
|
|
80
82
|
throws(() => method(args), error, 'Got expected error');
|
|
81
83
|
} else {
|
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
const {once} = require('events');
|
|
2
2
|
const {promisify} = require('util');
|
|
3
|
-
|
|
4
|
-
const
|
|
3
|
+
const strictSame = require('node:assert').strict.deepStrictEqual;
|
|
4
|
+
const test = require('node:test');
|
|
5
|
+
const {throws} = require('node:assert').strict;
|
|
5
6
|
|
|
6
7
|
const {getChanInfoResponse} = require('./../fixtures');
|
|
7
8
|
const {getInfoResponse} = require('./../fixtures');
|
|
@@ -895,7 +896,7 @@ const tests = [
|
|
|
895
896
|
];
|
|
896
897
|
|
|
897
898
|
tests.forEach(({args, description, error, expected}) => {
|
|
898
|
-
return test(description, async (
|
|
899
|
+
return test(description, async () => {
|
|
899
900
|
if (!!error) {
|
|
900
901
|
throws(() => subscribeToMultiPathPay(args), error, 'Got error');
|
|
901
902
|
} else {
|
|
@@ -916,7 +917,7 @@ tests.forEach(({args, description, error, expected}) => {
|
|
|
916
917
|
|
|
917
918
|
await nextTick();
|
|
918
919
|
|
|
919
|
-
await delay(50)
|
|
920
|
+
await delay(50);
|
|
920
921
|
|
|
921
922
|
// Make sure that no listener to error doesn't cause an issue
|
|
922
923
|
const sub2 = subscribeToMultiPathPay(args);
|
|
@@ -926,6 +927,6 @@ tests.forEach(({args, description, error, expected}) => {
|
|
|
926
927
|
strictSame(events, expected.events, 'Got expected events');
|
|
927
928
|
}
|
|
928
929
|
|
|
929
|
-
return
|
|
930
|
+
return;
|
|
930
931
|
});
|
|
931
932
|
});
|
|
@@ -1,4 +1,6 @@
|
|
|
1
|
-
const
|
|
1
|
+
const strictSame = require('node:assert').strict.deepStrictEqual;
|
|
2
|
+
const test = require('node:test');
|
|
3
|
+
const {throws} = require('node:assert').strict;
|
|
2
4
|
|
|
3
5
|
const {channels} = require('./../fixtures/hop_hints');
|
|
4
6
|
const {channelsFromHints} = require('./../../routing');
|
|
@@ -37,7 +39,7 @@ const tests = [
|
|
|
37
39
|
];
|
|
38
40
|
|
|
39
41
|
tests.forEach(({args, description, error, expected}) => {
|
|
40
|
-
return test(description,
|
|
42
|
+
return test(description, (t, end) => {
|
|
41
43
|
if (!!error) {
|
|
42
44
|
throws(() => findMaxPayable(args), error, 'Got expected error');
|
|
43
45
|
} else {
|
|
@@ -1,7 +1,8 @@
|
|
|
1
|
-
const {
|
|
1
|
+
const {rejects} = require('node:assert').strict;
|
|
2
|
+
const strictSame = require('node:assert').strict.deepStrictEqual;
|
|
3
|
+
const test = require('node:test');
|
|
2
4
|
|
|
3
5
|
const {getInfoResponse} = require('./../fixtures');
|
|
4
|
-
|
|
5
6
|
const isRoutePayable = require('./../../routing/is_route_payable');
|
|
6
7
|
|
|
7
8
|
const getInfoRes = () => JSON.parse(JSON.stringify(getInfoResponse));
|
|
@@ -206,15 +207,15 @@ const tests = [
|
|
|
206
207
|
];
|
|
207
208
|
|
|
208
209
|
tests.forEach(({args, description, error, expected}) => {
|
|
209
|
-
return test(description, async (
|
|
210
|
+
return test(description, async () => {
|
|
210
211
|
if (!!error) {
|
|
211
|
-
rejects(isRoutePayable(args), error, 'Got expected error');
|
|
212
|
+
await rejects(isRoutePayable(args), error, 'Got expected error');
|
|
212
213
|
} else {
|
|
213
214
|
const payable = await isRoutePayable(args);
|
|
214
215
|
|
|
215
|
-
|
|
216
|
+
strictSame(payable.is_payable, expected.is_payable, 'Got is_payable');
|
|
216
217
|
}
|
|
217
218
|
|
|
218
|
-
return
|
|
219
|
+
return;
|
|
219
220
|
});
|
|
220
221
|
});
|