@@ -254,11 +254,14 @@ A node:
254
254
before spending that HTLC-timeout output.
255
255
- for any committed HTLC that does NOT have an output in this commitment
256
256
transaction:
257
- - once the commitment transaction has reached reasonable depth:
258
- - MUST fail the corresponding incoming HTLC (if any).
259
- - if no * valid* commitment transaction contains an output corresponding to
260
- the HTLC.
261
- - MAY fail the corresponding incoming HTLC sooner.
257
+ - if the payment preimage is known:
258
+ - MUST fulfill the corresponding incoming HTLC (if any).
259
+ - otherwise:
260
+ - once the commitment transaction has reached reasonable depth:
261
+ - MUST fail the corresponding incoming HTLC (if any).
262
+ - if no * valid* commitment transaction contains an output corresponding to
263
+ the HTLC:
264
+ - MAY fail the corresponding incoming HTLC sooner.
262
265
263
266
### Rationale
264
267
@@ -281,12 +284,21 @@ detailed in
281
284
If the incoming HTLC is also on-chain, a node must simply wait for it to
282
285
timeout: there is no way to signal early failure.
283
286
284
- If an HTLC is too small to appear in * any commitment transaction* , it can be
285
- safely failed immediately. Otherwise, if an HTLC isn't in the * local commitment
286
- transaction* , a node needs to make sure that a blockchain reorganization, or
287
- race, does not switch to a commitment transaction that does contain the HTLC
288
- before the node fails it (hence the wait). The requirement that the incoming
289
- HTLC be failed before its own timeout still applies as an upper bound.
287
+ There are several reasons a committed HTLC may not have an output in the
288
+ confirmed commitment transaction: the HTLC may be smaller than
289
+ ` dust_limit_satoshis ` , the HTLC may not have been added to the commitment
290
+ transaction yet, or the HTLC may have already been failed or fulfilled. In any
291
+ case, if the payment preimage is known for the HTLC, the upstream HTLC needs to
292
+ be fulfilled to avoid loss of funds.
293
+
294
+ If the payment preimage is not known for the missing HTLC, the correct action
295
+ depends on the possibility of a blockchain reorganization that swaps out the
296
+ confirmed commitment transaction for one with the HTLC present.
297
+ If the HTLC is too small to appear in * any commitment transaction* , such a
298
+ reorganization is not possible, and the HTLC can be safely failed immediately.
299
+ Otherwise, a reorganization delay is required before failing the incoming HTLC.
300
+ The requirement that the incoming HTLC be failed before its own timeout still
301
+ applies as an upper bound.
290
302
291
303
## HTLC Output Handling: Local Commitment, Remote Offers
292
304
@@ -406,12 +418,14 @@ A local node:
406
418
- MUST * resolve* the output, by spending it to a convenient address.
407
419
- for any committed HTLC that does NOT have an output in this commitment
408
420
transaction:
409
- - once the commitment transaction has reached reasonable depth :
410
- - MUST fail the corresponding incoming HTLC (if any).
421
+ - if the payment preimage is known :
422
+ - MUST fulfill the corresponding incoming HTLC (if any).
411
423
- otherwise:
424
+ - once the commitment transaction has reached reasonable depth:
425
+ - MUST fail the corresponding incoming HTLC (if any).
412
426
- if no * valid* commitment transaction contains an output corresponding to
413
427
the HTLC:
414
- - MAY fail it sooner.
428
+ - MAY fail the corresponding incoming HTLC sooner.
415
429
416
430
### Rationale
417
431
@@ -437,13 +451,21 @@ back-fail any corresponding incoming HTLC, using `update_fail_htlc`
437
451
If the incoming HTLC is also on-chain, a node simply waits for it to
438
452
timeout, as there's no way to signal early failure.
439
453
440
- If an HTLC is too small to appear in * any commitment transaction* , it
441
- can be safely failed immediately. Otherwise,
442
- if an HTLC isn't in the * local commitment transaction* a node needs to make sure
443
- that a blockchain reorganization or race does not switch to a
444
- commitment transaction that does contain it before the node fails it: hence
445
- the wait. The requirement that the incoming HTLC be failed before its
446
- own timeout still applies as an upper bound.
454
+ There are several reasons a committed HTLC may not have an output in the
455
+ confirmed commitment transaction: the HTLC may be smaller than
456
+ ` dust_limit_satoshis ` , the HTLC may not have been added to the commitment
457
+ transaction yet, or the HTLC may have already been failed or fulfilled. In any
458
+ case, if the payment preimage is known for the HTLC, the upstream HTLC needs to
459
+ be fulfilled to avoid loss of funds.
460
+
461
+ If the payment preimage is not known for the missing HTLC, the correct action
462
+ depends on the possibility of a blockchain reorganization that swaps out the
463
+ confirmed commitment transaction for one with the HTLC present.
464
+ If the HTLC is too small to appear in * any commitment transaction* , such a
465
+ reorganization is not possible, and the HTLC can be safely failed immediately.
466
+ Otherwise, a reorganization delay is required before failing the incoming HTLC.
467
+ The requirement that the incoming HTLC be failed before its own timeout still
468
+ applies as an upper bound.
447
469
448
470
## HTLC Output Handling: Remote Commitment, Remote Offers
449
471
0 commit comments