@@ -469,6 +469,7 @@ The processing node:
469
469
- if the processing node does not have a peer with the matching address:
470
470
- MUST drop the packet.
471
471
- MUST signal a route failure.
472
+
472
473
# Shared Secret
473
474
474
475
The origin node performs ECDH with each hop of the route, in order to establish a secret.
@@ -593,11 +594,6 @@ Where `hmac` is an HMAC authenticating the remainder of the packet, with a key
593
594
generated using the above process, with key type ` um ` , ` failuremsg ` as defined
594
595
below, and ` pad ` as the extra bytes used to conceal length.
595
596
596
- The erring node:
597
- - SHOULD set ` pad ` such that the ` failure_len ` plus ` pad_len ` is equal to 256.
598
- - Note: this value is 118 bytes longer than the longest currently-defined
599
- message.
600
-
601
597
The erring node then generates a new key, using the key type ` ammag ` .
602
598
This key is then used to generate a pseudo-random stream, which is in turn
603
599
applied to the packet using ` XOR ` .
@@ -618,22 +614,29 @@ key, and computes the HMAC, using each hop's `um` key.
618
614
The origin node can detect the sender of the error message by matching the
619
615
` hmac ` field with the computed HMAC.
620
616
621
- The origin node:
617
+ The association between the forward and return packets is handled outside of
618
+ this onion routing protocol, e.g. via association with an HTLC in a payment
619
+ channel.
620
+
621
+ ### Requirements
622
+
623
+ The _ erring node_ :
624
+ - SHOULD set ` pad ` such that the ` failure_len ` plus ` pad_len ` is equal to 256.
625
+ - Note: this value is 118 bytes longer than the longest currently-defined
626
+ message.
627
+
628
+ The _ origin node_ :
622
629
- once the return message has been decrypted:
623
630
- SHOULD store a copy of the message.
624
631
- SHOULD continue decrypting, until the loop has been repeated 20 times.
625
632
- SHOULD use constant ` ammag ` and ` um ` keys to obfuscate the route length.
626
633
627
- The association between the forward and return packets is handled outside of
628
- this onion routing protocol, e.g. via association with an HTLC in a payment
629
- channel.
630
-
631
634
## Failure Messages
632
635
633
636
The failure message encapsulated in ` failuremsg ` has an identical format as
634
637
a normal message: a 2-byte type ` failure_code ` followed by data applicable
635
- to that type. Following is a list of the currently supported ` failure_code `
636
- values and their required use cases .
638
+ to that type. Below is a list of the currently supported ` failure_code `
639
+ values, followed by their use case requirements .
637
640
638
641
Notice that the ` failure_code ` s are not of the same type as other message types,
639
642
defined in other BOLTs, as they are not sent directly on the transport layer
@@ -730,7 +733,7 @@ An _erring node_:
730
733
- MUST select one of the above error codes when creating an error message.
731
734
- MUST include the appropriate data for that particular error type.
732
735
- if there is more than one error:
733
- - SHOULD select the first error it encounters in list above.
736
+ - SHOULD select the first error it encounters from list above.
734
737
735
738
Any _ erring node_ MAY:
736
739
- if the ` realm ` byte is unknown:
@@ -749,16 +752,16 @@ A _forwarding node_ MAY, but a _final node_ MUST NOT:
749
752
- if the onion HMAC is incorrect:
750
753
- return an ` invalid_onion_hmac ` error.
751
754
- if the ephemeral key in the onion is unparsable:
752
- - return ` invalid_onion_key ` error.
753
- - if an otherwise unspecified, transient error occurs in the outgoing channel
754
- (i.e. during forwarding to its receiving peer), e.g. channel capacity reached,
755
- too many in-flight HTLCs, etc.:
755
+ - return an ` invalid_onion_key ` error.
756
+ - if, during forwarding to its receiving peer, an otherwise unspecified,
757
+ transient error occurs in the outgoing channel ( e.g. channel capacity reached,
758
+ too many in-flight HTLCs, etc.) :
756
759
- return a ` temporary_channel_failure ` error.
757
760
- if an otherwise unspecified, permanent error occurs during forwarding to its
758
761
receiving peer (e.g. channel recently closed):
759
762
- return a ` permanent_channel_failure ` error.
760
763
- if the outgoing channel has requirements advertised in its
761
- ` channel_announcement ` ` features ` , which were NOT included in the onion:
764
+ ` channel_announcement ` 's ` features ` , which were NOT included in the onion:
762
765
- return a ` required_channel_feature_missing ` error.
763
766
- if the receiving peer specified by the onion is NOT known:
764
767
- return an ` unknown_next_peer ` error.
@@ -768,20 +771,20 @@ A _forwarding node_ MAY, but a _final node_ MUST NOT:
768
771
- return an ` amount_below_minimum ` error.
769
772
- if the HTLC does NOT pay a sufficient fee:
770
773
- report the amount of the incoming HTLC and the current channel setting for
771
- the outgoing channel:
774
+ the outgoing channel.
772
775
- return a ` fee_insufficient ` error.
773
776
- if the ` outgoing_cltv_value ` does NOT match the ` update_add_htlc ` 's
774
777
` cltv_expiry ` minus the ` cltv_expiry_delta ` for the outgoing channel:
775
778
- report the ` cltv_expiry ` and the current channel setting for the outgoing
776
779
channel.
777
780
- return an ` incorrect_cltv_expiry ` error.
778
- - if the ` cltv_expiry ` is too near:
781
+ - if the ` cltv_expiry ` is unreasonably near the present :
779
782
- report the current channel setting for the outgoing channel.
780
783
- return an ` expiry_too_soon ` error.
781
784
- if the ` cltv_expiry ` is unreasonably far in the future:
782
785
- return an ` expiry_too_far ` error.
783
786
- if the channel is disabled:
784
- - report the current channel setting for the outgoing channel:
787
+ - report the current channel setting for the outgoing channel.
785
788
- return a ` channel_disabled ` error.
786
789
787
790
An _ intermediate hop_ MUST NOT, but the _ final node_ :
@@ -796,9 +799,9 @@ An _intermediate hop_ MUST NOT, but the _final node_:
796
799
- if the amount paid is more than twice the amount expected:
797
800
- SHOULD fail the HTLC.
798
801
- SHOULD return an ` incorrect_payment_amount ` error.
799
- - Note: this allows the origin node to reduce information leakage by
800
- altering the amount while not allowing for accidental gross overpayment.
801
- - if the ` cltv_expiry ` value is too near the present:
802
+ - Note: this allows the origin node to reduce information leakage by
803
+ altering the amount while not allowing for accidental gross overpayment.
804
+ - if the ` cltv_expiry ` value is unreasonably near the present:
802
805
- MUST fail the HTLC.
803
806
- MUST return a ` final_expiry_too_soon ` error.
804
807
- if the ` outgoing_cltv_value ` does NOT correspond with the ` cltv_expiry ` from
@@ -810,6 +813,8 @@ An _intermediate hop_ MUST NOT, but the _final node_:
810
813
811
814
## Receiving Failure Codes
812
815
816
+ ### Requirements
817
+
813
818
The _ origin node_ :
814
819
- MUST ignore any extra bytes in ` failuremsg ` .
815
820
- if the _ final node_ is returning the error:
0 commit comments