lightning 10.27.4 → 10.27.5
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 +5 -0
- package/lnd_methods/offchain/subscribe_to_pay.js +21 -10
- package/package.json +2 -2
package/CHANGELOG.md
CHANGED
|
@@ -307,21 +307,24 @@ module.exports = args => {
|
|
|
307
307
|
const finalCltv = !args.cltv_delta ? defaultCltvDelta : args.cltv_delta;
|
|
308
308
|
|
|
309
309
|
asyncAuto({
|
|
310
|
-
// Determine what features would be used with the payment
|
|
311
|
-
|
|
310
|
+
// Determine what cltv delta and features would be used with the payment
|
|
311
|
+
aspects: cbk => {
|
|
312
312
|
// Exit early when there are no features to look at
|
|
313
313
|
if (!args.features && !args.request) {
|
|
314
|
-
return cbk(null, []);
|
|
314
|
+
return cbk(null, {features: []});
|
|
315
315
|
}
|
|
316
316
|
|
|
317
317
|
// Exit early when feature bits are specified directly
|
|
318
318
|
if (!!features) {
|
|
319
|
-
return cbk(null, features);
|
|
319
|
+
return cbk(null, {features});
|
|
320
320
|
}
|
|
321
321
|
|
|
322
322
|
const request = parsePaymentRequest({request: args.request});
|
|
323
323
|
|
|
324
|
-
return cbk(null,
|
|
324
|
+
return cbk(null, {
|
|
325
|
+
features: request.features.map(n => n.bit),
|
|
326
|
+
final_cltv: request.cltv_delta,
|
|
327
|
+
});
|
|
325
328
|
},
|
|
326
329
|
|
|
327
330
|
// Determine the block height to figure out the height delta
|
|
@@ -354,8 +357,8 @@ module.exports = args => {
|
|
|
354
357
|
},
|
|
355
358
|
|
|
356
359
|
// Validate the payment request features
|
|
357
|
-
checkFeatures: ['
|
|
358
|
-
const bit =
|
|
360
|
+
checkFeatures: ['aspects', ({aspects}, cbk) => {
|
|
361
|
+
const bit = aspects.features.find(n => unsupportedFeatures.includes(n));
|
|
359
362
|
|
|
360
363
|
if (!!bit) {
|
|
361
364
|
return cbk([501, 'UnsupportedPaymentFeatureInPayRequest', {bit}]);
|
|
@@ -365,18 +368,26 @@ module.exports = args => {
|
|
|
365
368
|
}],
|
|
366
369
|
|
|
367
370
|
// Determine the maximum CLTV delta
|
|
368
|
-
maxCltvDelta: ['getHeight', ({getHeight}, cbk) => {
|
|
371
|
+
maxCltvDelta: ['aspects', 'getHeight', ({aspects, getHeight}, cbk) => {
|
|
369
372
|
if (!args.max_timeout_height) {
|
|
370
373
|
return cbk();
|
|
371
374
|
}
|
|
372
375
|
|
|
373
376
|
const currentHeight = getHeight.current_block_height;
|
|
377
|
+
const lastCltv = !args.request ? finalCltv : aspects.final_cltv;
|
|
374
378
|
|
|
375
379
|
const maxDelta = cltvLimit(args.max_timeout_height, currentHeight);
|
|
376
380
|
|
|
377
381
|
// The max cltv delta cannot be lower than the final cltv delta + buffer
|
|
378
|
-
if (!!maxDelta && !!
|
|
379
|
-
return cbk([
|
|
382
|
+
if (!!maxDelta && !!lastCltv && maxDelta < lastCltv + cltvBuf) {
|
|
383
|
+
return cbk([
|
|
384
|
+
400,
|
|
385
|
+
'MaxTimeoutTooNearCurrentHeightToMakePayment',
|
|
386
|
+
{
|
|
387
|
+
last_cltv: lastCltv,
|
|
388
|
+
max_delta: maxDelta,
|
|
389
|
+
},
|
|
390
|
+
]);
|
|
380
391
|
}
|
|
381
392
|
|
|
382
393
|
return cbk(null, maxDelta);
|
package/package.json
CHANGED
|
@@ -9,7 +9,7 @@
|
|
|
9
9
|
"dependencies": {
|
|
10
10
|
"@grpc/grpc-js": "1.14.3",
|
|
11
11
|
"@grpc/proto-loader": "0.8.0",
|
|
12
|
-
"@types/node": "25.0.
|
|
12
|
+
"@types/node": "25.0.1",
|
|
13
13
|
"@types/request": "2.48.13",
|
|
14
14
|
"@types/ws": "8.18.1",
|
|
15
15
|
"async": "3.2.6",
|
|
@@ -51,5 +51,5 @@
|
|
|
51
51
|
"directory": "test-typescript/typescript"
|
|
52
52
|
},
|
|
53
53
|
"types": "index.d.ts",
|
|
54
|
-
"version": "10.27.
|
|
54
|
+
"version": "10.27.5"
|
|
55
55
|
}
|