@@ -2009,14 +2009,14 @@ impl Hop {
2009
2009
#[ derive( Debug ) ]
2010
2010
pub ( crate ) enum OnionDecodeErr {
2011
2011
/// 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 } ,
2013
2013
/// We failed to decode the onion payload.
2014
2014
///
2015
2015
/// If the payload we failed to decode belonged to a Trampoline onion, following the successful
2016
2016
/// decoding of the outer onion, the trampoline_shared_secret field should be set.
2017
2017
Relay {
2018
2018
err_msg : & ' static str ,
2019
- err_code : LocalHTLCFailureReason ,
2019
+ reason : LocalHTLCFailureReason ,
2020
2020
shared_secret : SharedSecret ,
2021
2021
trampoline_shared_secret : Option < SharedSecret > ,
2022
2022
} ,
@@ -2067,12 +2067,12 @@ where
2067
2067
return Err ( OnionDecodeErr :: Malformed {
2068
2068
err_msg :
2069
2069
"Final Node OnionHopData provided for us as an intermediary node" ,
2070
- err_code : LocalHTLCFailureReason :: InvalidOnionBlinding ,
2070
+ reason : LocalHTLCFailureReason :: InvalidOnionBlinding ,
2071
2071
} ) ;
2072
2072
}
2073
2073
Err ( OnionDecodeErr :: Relay {
2074
2074
err_msg : "Final Node OnionHopData provided for us as an intermediary node" ,
2075
- err_code : LocalHTLCFailureReason :: InvalidOnionPayload ,
2075
+ reason : LocalHTLCFailureReason :: InvalidOnionPayload ,
2076
2076
shared_secret,
2077
2077
trampoline_shared_secret : None ,
2078
2078
} )
@@ -2167,7 +2167,7 @@ where
2167
2167
if hop_data. intro_node_blinding_point . is_some ( ) {
2168
2168
return Err ( OnionDecodeErr :: Relay {
2169
2169
err_msg : "Non-final intro node Trampoline onion data provided to us as last hop" ,
2170
- err_code : LocalHTLCFailureReason :: InvalidOnionPayload ,
2170
+ reason : LocalHTLCFailureReason :: InvalidOnionPayload ,
2171
2171
shared_secret,
2172
2172
trampoline_shared_secret : Some ( SharedSecret :: from_bytes (
2173
2173
trampoline_shared_secret,
@@ -2176,14 +2176,14 @@ where
2176
2176
}
2177
2177
Err ( OnionDecodeErr :: Malformed {
2178
2178
err_msg : "Non-final Trampoline onion data provided to us as last hop" ,
2179
- err_code : LocalHTLCFailureReason :: InvalidOnionBlinding ,
2179
+ reason : LocalHTLCFailureReason :: InvalidOnionBlinding ,
2180
2180
} )
2181
2181
} ,
2182
2182
Ok ( ( msgs:: InboundTrampolinePayload :: BlindedReceive ( hop_data) , Some ( _) ) ) => {
2183
2183
if hop_data. intro_node_blinding_point . is_some ( ) {
2184
2184
return Err ( OnionDecodeErr :: Relay {
2185
2185
err_msg : "Final Trampoline intro node onion data provided to us as intermediate hop" ,
2186
- err_code : LocalHTLCFailureReason :: InvalidOnionPayload ,
2186
+ reason : LocalHTLCFailureReason :: InvalidOnionPayload ,
2187
2187
shared_secret,
2188
2188
trampoline_shared_secret : Some ( SharedSecret :: from_bytes (
2189
2189
trampoline_shared_secret,
@@ -2193,13 +2193,13 @@ where
2193
2193
Err ( OnionDecodeErr :: Malformed {
2194
2194
err_msg :
2195
2195
"Final Trampoline onion data provided to us as intermediate hop" ,
2196
- err_code : LocalHTLCFailureReason :: InvalidOnionBlinding ,
2196
+ reason : LocalHTLCFailureReason :: InvalidOnionBlinding ,
2197
2197
} )
2198
2198
} ,
2199
2199
Ok ( ( msgs:: InboundTrampolinePayload :: Forward ( _) , None ) ) => {
2200
2200
Err ( OnionDecodeErr :: Relay {
2201
2201
err_msg : "Non-final Trampoline onion data provided to us as last hop" ,
2202
- err_code : LocalHTLCFailureReason :: InvalidOnionPayload ,
2202
+ reason : LocalHTLCFailureReason :: InvalidOnionPayload ,
2203
2203
shared_secret,
2204
2204
trampoline_shared_secret : Some ( SharedSecret :: from_bytes (
2205
2205
trampoline_shared_secret,
@@ -2210,7 +2210,7 @@ where
2210
2210
Err ( OnionDecodeErr :: Relay {
2211
2211
err_msg :
2212
2212
"Final Trampoline onion data provided to us as intermediate hop" ,
2213
- err_code : LocalHTLCFailureReason :: InvalidOnionPayload ,
2213
+ reason : LocalHTLCFailureReason :: InvalidOnionPayload ,
2214
2214
shared_secret,
2215
2215
trampoline_shared_secret : Some ( SharedSecret :: from_bytes (
2216
2216
trampoline_shared_secret,
@@ -2224,12 +2224,12 @@ where
2224
2224
if blinding_point. is_some ( ) {
2225
2225
return Err ( OnionDecodeErr :: Malformed {
2226
2226
err_msg : "Intermediate Node OnionHopData provided for us as a final node" ,
2227
- err_code : LocalHTLCFailureReason :: InvalidOnionBlinding ,
2227
+ reason : LocalHTLCFailureReason :: InvalidOnionBlinding ,
2228
2228
} ) ;
2229
2229
}
2230
2230
Err ( OnionDecodeErr :: Relay {
2231
2231
err_msg : "Intermediate Node OnionHopData provided for us as a final node" ,
2232
- err_code : LocalHTLCFailureReason :: InvalidOnionPayload ,
2232
+ reason : LocalHTLCFailureReason :: InvalidOnionPayload ,
2233
2233
shared_secret,
2234
2234
trampoline_shared_secret : None ,
2235
2235
} )
@@ -2358,7 +2358,7 @@ fn decode_next_hop<T, R: ReadableArgs<T>, N: NextPacketBytes>(
2358
2358
if !fixed_time_eq ( & Hmac :: from_engine ( hmac) . to_byte_array ( ) , & hmac_bytes) {
2359
2359
return Err ( OnionDecodeErr :: Malformed {
2360
2360
err_msg : "HMAC Check failed" ,
2361
- err_code : LocalHTLCFailureReason :: InvalidOnionHMAC ,
2361
+ reason : LocalHTLCFailureReason :: InvalidOnionHMAC ,
2362
2362
} ) ;
2363
2363
}
2364
2364
@@ -2378,7 +2378,7 @@ fn decode_next_hop<T, R: ReadableArgs<T>, N: NextPacketBytes>(
2378
2378
} ;
2379
2379
return Err ( OnionDecodeErr :: Relay {
2380
2380
err_msg : "Unable to decode our hop data" ,
2381
- err_code : error_code,
2381
+ reason : error_code,
2382
2382
shared_secret : SharedSecret :: from_bytes ( shared_secret) ,
2383
2383
trampoline_shared_secret : None ,
2384
2384
} ) ;
@@ -2388,7 +2388,7 @@ fn decode_next_hop<T, R: ReadableArgs<T>, N: NextPacketBytes>(
2388
2388
if let Err ( _) = chacha_stream. read_exact ( & mut hmac[ ..] ) {
2389
2389
return Err ( OnionDecodeErr :: Relay {
2390
2390
err_msg : "Unable to decode our hop data" ,
2391
- err_code : LocalHTLCFailureReason :: InvalidOnionPayload ,
2391
+ reason : LocalHTLCFailureReason :: InvalidOnionPayload ,
2392
2392
shared_secret : SharedSecret :: from_bytes ( shared_secret) ,
2393
2393
trampoline_shared_secret : None ,
2394
2394
} ) ;
0 commit comments