@@ -2009,14 +2009,14 @@ impl Hop {
20092009#[ derive( Debug ) ]
20102010pub ( crate ) enum OnionDecodeErr {
20112011 /// The HMAC of the onion packet did not match the hop data.
2012- Malformed { err_msg : & ' static str , err_code : LocalHTLCFailureReason } ,
2012+ Malformed { err_msg : & ' static str , reason : LocalHTLCFailureReason } ,
20132013 /// We failed to decode the onion payload.
20142014 ///
20152015 /// If the payload we failed to decode belonged to a Trampoline onion, following the successful
20162016 /// decoding of the outer onion, the trampoline_shared_secret field should be set.
20172017 Relay {
20182018 err_msg : & ' static str ,
2019- err_code : LocalHTLCFailureReason ,
2019+ reason : LocalHTLCFailureReason ,
20202020 shared_secret : SharedSecret ,
20212021 trampoline_shared_secret : Option < SharedSecret > ,
20222022 } ,
@@ -2067,12 +2067,12 @@ where
20672067 return Err ( OnionDecodeErr :: Malformed {
20682068 err_msg :
20692069 "Final Node OnionHopData provided for us as an intermediary node" ,
2070- err_code : LocalHTLCFailureReason :: InvalidOnionBlinding ,
2070+ reason : LocalHTLCFailureReason :: InvalidOnionBlinding ,
20712071 } ) ;
20722072 }
20732073 Err ( OnionDecodeErr :: Relay {
20742074 err_msg : "Final Node OnionHopData provided for us as an intermediary node" ,
2075- err_code : LocalHTLCFailureReason :: InvalidOnionPayload ,
2075+ reason : LocalHTLCFailureReason :: InvalidOnionPayload ,
20762076 shared_secret,
20772077 trampoline_shared_secret : None ,
20782078 } )
@@ -2167,7 +2167,7 @@ where
21672167 if hop_data. intro_node_blinding_point . is_some ( ) {
21682168 return Err ( OnionDecodeErr :: Relay {
21692169 err_msg : "Non-final intro node Trampoline onion data provided to us as last hop" ,
2170- err_code : LocalHTLCFailureReason :: InvalidOnionPayload ,
2170+ reason : LocalHTLCFailureReason :: InvalidOnionPayload ,
21712171 shared_secret,
21722172 trampoline_shared_secret : Some ( SharedSecret :: from_bytes (
21732173 trampoline_shared_secret,
@@ -2176,14 +2176,14 @@ where
21762176 }
21772177 Err ( OnionDecodeErr :: Malformed {
21782178 err_msg : "Non-final Trampoline onion data provided to us as last hop" ,
2179- err_code : LocalHTLCFailureReason :: InvalidOnionBlinding ,
2179+ reason : LocalHTLCFailureReason :: InvalidOnionBlinding ,
21802180 } )
21812181 } ,
21822182 Ok ( ( msgs:: InboundTrampolinePayload :: BlindedReceive ( hop_data) , Some ( _) ) ) => {
21832183 if hop_data. intro_node_blinding_point . is_some ( ) {
21842184 return Err ( OnionDecodeErr :: Relay {
21852185 err_msg : "Final Trampoline intro node onion data provided to us as intermediate hop" ,
2186- err_code : LocalHTLCFailureReason :: InvalidOnionPayload ,
2186+ reason : LocalHTLCFailureReason :: InvalidOnionPayload ,
21872187 shared_secret,
21882188 trampoline_shared_secret : Some ( SharedSecret :: from_bytes (
21892189 trampoline_shared_secret,
@@ -2193,13 +2193,13 @@ where
21932193 Err ( OnionDecodeErr :: Malformed {
21942194 err_msg :
21952195 "Final Trampoline onion data provided to us as intermediate hop" ,
2196- err_code : LocalHTLCFailureReason :: InvalidOnionBlinding ,
2196+ reason : LocalHTLCFailureReason :: InvalidOnionBlinding ,
21972197 } )
21982198 } ,
21992199 Ok ( ( msgs:: InboundTrampolinePayload :: Forward ( _) , None ) ) => {
22002200 Err ( OnionDecodeErr :: Relay {
22012201 err_msg : "Non-final Trampoline onion data provided to us as last hop" ,
2202- err_code : LocalHTLCFailureReason :: InvalidOnionPayload ,
2202+ reason : LocalHTLCFailureReason :: InvalidOnionPayload ,
22032203 shared_secret,
22042204 trampoline_shared_secret : Some ( SharedSecret :: from_bytes (
22052205 trampoline_shared_secret,
@@ -2210,7 +2210,7 @@ where
22102210 Err ( OnionDecodeErr :: Relay {
22112211 err_msg :
22122212 "Final Trampoline onion data provided to us as intermediate hop" ,
2213- err_code : LocalHTLCFailureReason :: InvalidOnionPayload ,
2213+ reason : LocalHTLCFailureReason :: InvalidOnionPayload ,
22142214 shared_secret,
22152215 trampoline_shared_secret : Some ( SharedSecret :: from_bytes (
22162216 trampoline_shared_secret,
@@ -2224,12 +2224,12 @@ where
22242224 if blinding_point. is_some ( ) {
22252225 return Err ( OnionDecodeErr :: Malformed {
22262226 err_msg : "Intermediate Node OnionHopData provided for us as a final node" ,
2227- err_code : LocalHTLCFailureReason :: InvalidOnionBlinding ,
2227+ reason : LocalHTLCFailureReason :: InvalidOnionBlinding ,
22282228 } ) ;
22292229 }
22302230 Err ( OnionDecodeErr :: Relay {
22312231 err_msg : "Intermediate Node OnionHopData provided for us as a final node" ,
2232- err_code : LocalHTLCFailureReason :: InvalidOnionPayload ,
2232+ reason : LocalHTLCFailureReason :: InvalidOnionPayload ,
22332233 shared_secret,
22342234 trampoline_shared_secret : None ,
22352235 } )
@@ -2358,7 +2358,7 @@ fn decode_next_hop<T, R: ReadableArgs<T>, N: NextPacketBytes>(
23582358 if !fixed_time_eq ( & Hmac :: from_engine ( hmac) . to_byte_array ( ) , & hmac_bytes) {
23592359 return Err ( OnionDecodeErr :: Malformed {
23602360 err_msg : "HMAC Check failed" ,
2361- err_code : LocalHTLCFailureReason :: InvalidOnionHMAC ,
2361+ reason : LocalHTLCFailureReason :: InvalidOnionHMAC ,
23622362 } ) ;
23632363 }
23642364
@@ -2378,7 +2378,7 @@ fn decode_next_hop<T, R: ReadableArgs<T>, N: NextPacketBytes>(
23782378 } ;
23792379 return Err ( OnionDecodeErr :: Relay {
23802380 err_msg : "Unable to decode our hop data" ,
2381- err_code : error_code,
2381+ reason : error_code,
23822382 shared_secret : SharedSecret :: from_bytes ( shared_secret) ,
23832383 trampoline_shared_secret : None ,
23842384 } ) ;
@@ -2388,7 +2388,7 @@ fn decode_next_hop<T, R: ReadableArgs<T>, N: NextPacketBytes>(
23882388 if let Err ( _) = chacha_stream. read_exact ( & mut hmac[ ..] ) {
23892389 return Err ( OnionDecodeErr :: Relay {
23902390 err_msg : "Unable to decode our hop data" ,
2391- err_code : LocalHTLCFailureReason :: InvalidOnionPayload ,
2391+ reason : LocalHTLCFailureReason :: InvalidOnionPayload ,
23922392 shared_secret : SharedSecret :: from_bytes ( shared_secret) ,
23932393 trampoline_shared_secret : None ,
23942394 } ) ;
0 commit comments