@@ -1986,14 +1986,14 @@ impl Hop {
19861986#[ derive( Debug ) ]
19871987pub ( crate ) enum OnionDecodeErr {
19881988 /// The HMAC of the onion packet did not match the hop data.
1989- Malformed { err_msg : & ' static str , err_code : LocalHTLCFailureReason } ,
1989+ Malformed { err_msg : & ' static str , reason : LocalHTLCFailureReason } ,
19901990 /// We failed to decode the onion payload.
19911991 ///
19921992 /// If the payload we failed to decode belonged to a Trampoline onion, following the successful
19931993 /// decoding of the outer onion, the trampoline_shared_secret field should be set.
19941994 Relay {
19951995 err_msg : & ' static str ,
1996- err_code : LocalHTLCFailureReason ,
1996+ reason : LocalHTLCFailureReason ,
19971997 shared_secret : SharedSecret ,
19981998 trampoline_shared_secret : Option < SharedSecret > ,
19991999 } ,
@@ -2044,12 +2044,12 @@ where
20442044 return Err ( OnionDecodeErr :: Malformed {
20452045 err_msg :
20462046 "Final Node OnionHopData provided for us as an intermediary node" ,
2047- err_code : LocalHTLCFailureReason :: InvalidOnionBlinding ,
2047+ reason : LocalHTLCFailureReason :: InvalidOnionBlinding ,
20482048 } ) ;
20492049 }
20502050 Err ( OnionDecodeErr :: Relay {
20512051 err_msg : "Final Node OnionHopData provided for us as an intermediary node" ,
2052- err_code : LocalHTLCFailureReason :: InvalidOnionPayload ,
2052+ reason : LocalHTLCFailureReason :: InvalidOnionPayload ,
20532053 shared_secret,
20542054 trampoline_shared_secret : None ,
20552055 } )
@@ -2144,7 +2144,7 @@ where
21442144 if hop_data. intro_node_blinding_point . is_some ( ) {
21452145 return Err ( OnionDecodeErr :: Relay {
21462146 err_msg : "Non-final intro node Trampoline onion data provided to us as last hop" ,
2147- err_code : LocalHTLCFailureReason :: InvalidOnionPayload ,
2147+ reason : LocalHTLCFailureReason :: InvalidOnionPayload ,
21482148 shared_secret,
21492149 trampoline_shared_secret : Some ( SharedSecret :: from_bytes (
21502150 trampoline_shared_secret,
@@ -2153,14 +2153,14 @@ where
21532153 }
21542154 Err ( OnionDecodeErr :: Malformed {
21552155 err_msg : "Non-final Trampoline onion data provided to us as last hop" ,
2156- err_code : LocalHTLCFailureReason :: InvalidOnionBlinding ,
2156+ reason : LocalHTLCFailureReason :: InvalidOnionBlinding ,
21572157 } )
21582158 } ,
21592159 Ok ( ( msgs:: InboundTrampolinePayload :: BlindedReceive ( hop_data) , Some ( _) ) ) => {
21602160 if hop_data. intro_node_blinding_point . is_some ( ) {
21612161 return Err ( OnionDecodeErr :: Relay {
21622162 err_msg : "Final Trampoline intro node onion data provided to us as intermediate hop" ,
2163- err_code : LocalHTLCFailureReason :: InvalidOnionPayload ,
2163+ reason : LocalHTLCFailureReason :: InvalidOnionPayload ,
21642164 shared_secret,
21652165 trampoline_shared_secret : Some ( SharedSecret :: from_bytes (
21662166 trampoline_shared_secret,
@@ -2170,13 +2170,13 @@ where
21702170 Err ( OnionDecodeErr :: Malformed {
21712171 err_msg :
21722172 "Final Trampoline onion data provided to us as intermediate hop" ,
2173- err_code : LocalHTLCFailureReason :: InvalidOnionBlinding ,
2173+ reason : LocalHTLCFailureReason :: InvalidOnionBlinding ,
21742174 } )
21752175 } ,
21762176 Ok ( ( msgs:: InboundTrampolinePayload :: Forward ( _) , None ) ) => {
21772177 Err ( OnionDecodeErr :: Relay {
21782178 err_msg : "Non-final Trampoline onion data provided to us as last hop" ,
2179- err_code : LocalHTLCFailureReason :: InvalidOnionPayload ,
2179+ reason : LocalHTLCFailureReason :: InvalidOnionPayload ,
21802180 shared_secret,
21812181 trampoline_shared_secret : Some ( SharedSecret :: from_bytes (
21822182 trampoline_shared_secret,
@@ -2187,7 +2187,7 @@ where
21872187 Err ( OnionDecodeErr :: Relay {
21882188 err_msg :
21892189 "Final Trampoline onion data provided to us as intermediate hop" ,
2190- err_code : LocalHTLCFailureReason :: InvalidOnionPayload ,
2190+ reason : LocalHTLCFailureReason :: InvalidOnionPayload ,
21912191 shared_secret,
21922192 trampoline_shared_secret : Some ( SharedSecret :: from_bytes (
21932193 trampoline_shared_secret,
@@ -2201,12 +2201,12 @@ where
22012201 if blinding_point. is_some ( ) {
22022202 return Err ( OnionDecodeErr :: Malformed {
22032203 err_msg : "Intermediate Node OnionHopData provided for us as a final node" ,
2204- err_code : LocalHTLCFailureReason :: InvalidOnionBlinding ,
2204+ reason : LocalHTLCFailureReason :: InvalidOnionBlinding ,
22052205 } ) ;
22062206 }
22072207 Err ( OnionDecodeErr :: Relay {
22082208 err_msg : "Intermediate Node OnionHopData provided for us as a final node" ,
2209- err_code : LocalHTLCFailureReason :: InvalidOnionPayload ,
2209+ reason : LocalHTLCFailureReason :: InvalidOnionPayload ,
22102210 shared_secret,
22112211 trampoline_shared_secret : None ,
22122212 } )
@@ -2329,7 +2329,7 @@ fn decode_next_hop<T, R: ReadableArgs<T>, N: NextPacketBytes>(
23292329 if !fixed_time_eq ( & Hmac :: from_engine ( hmac) . to_byte_array ( ) , & hmac_bytes) {
23302330 return Err ( OnionDecodeErr :: Malformed {
23312331 err_msg : "HMAC Check failed" ,
2332- err_code : LocalHTLCFailureReason :: InvalidOnionHMAC ,
2332+ reason : LocalHTLCFailureReason :: InvalidOnionHMAC ,
23332333 } ) ;
23342334 }
23352335
@@ -2349,7 +2349,7 @@ fn decode_next_hop<T, R: ReadableArgs<T>, N: NextPacketBytes>(
23492349 } ;
23502350 return Err ( OnionDecodeErr :: Relay {
23512351 err_msg : "Unable to decode our hop data" ,
2352- err_code : error_code,
2352+ reason : error_code,
23532353 shared_secret : SharedSecret :: from_bytes ( shared_secret) ,
23542354 trampoline_shared_secret : None ,
23552355 } ) ;
@@ -2359,7 +2359,7 @@ fn decode_next_hop<T, R: ReadableArgs<T>, N: NextPacketBytes>(
23592359 if let Err ( _) = chacha_stream. read_exact ( & mut hmac[ ..] ) {
23602360 return Err ( OnionDecodeErr :: Relay {
23612361 err_msg : "Unable to decode our hop data" ,
2362- err_code : LocalHTLCFailureReason :: InvalidOnionPayload ,
2362+ reason : LocalHTLCFailureReason :: InvalidOnionPayload ,
23632363 shared_secret : SharedSecret :: from_bytes ( shared_secret) ,
23642364 trampoline_shared_secret : None ,
23652365 } ) ;
0 commit comments