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 CHANGED
@@ -1,5 +1,10 @@
1
1
  # Versions
2
2
 
3
+ ## 10.26.5
4
+
5
+ - `pay`, `payViaPaymentRequest`, `subscribeToPayViaRequest`: Allow short CLTV
6
+ limit payments when the payment request final CLTV delta is very short
7
+
3
8
  ## 10.26.4
4
9
 
5
10
  - Add support for LND 0.20.0
@@ -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
- featureBits: cbk => {
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, request.features.map(n => n.bit));
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: ['featureBits', ({featureBits}, cbk) => {
358
- const bit = featureBits.find(n => unsupportedFeatures.includes(n));
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 && !!finalCltv && maxDelta < finalCltv + cltvBuf) {
379
- return cbk([400, 'MaxTimeoutTooNearCurrentHeightToMakePayment']);
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.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.4"
54
+ "version": "10.27.5"
55
55
  }