@@ -1986,14 +1986,14 @@ impl Hop {
1986
1986
#[ derive( Debug ) ]
1987
1987
pub ( crate ) enum OnionDecodeErr {
1988
1988
/// 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 } ,
1990
1990
/// We failed to decode the onion payload.
1991
1991
///
1992
1992
/// If the payload we failed to decode belonged to a Trampoline onion, following the successful
1993
1993
/// decoding of the outer onion, the trampoline_shared_secret field should be set.
1994
1994
Relay {
1995
1995
err_msg : & ' static str ,
1996
- err_code : LocalHTLCFailureReason ,
1996
+ reason : LocalHTLCFailureReason ,
1997
1997
shared_secret : SharedSecret ,
1998
1998
trampoline_shared_secret : Option < SharedSecret > ,
1999
1999
} ,
@@ -2044,12 +2044,12 @@ where
2044
2044
return Err ( OnionDecodeErr :: Malformed {
2045
2045
err_msg :
2046
2046
"Final Node OnionHopData provided for us as an intermediary node" ,
2047
- err_code : LocalHTLCFailureReason :: InvalidOnionBlinding ,
2047
+ reason : LocalHTLCFailureReason :: InvalidOnionBlinding ,
2048
2048
} ) ;
2049
2049
}
2050
2050
Err ( OnionDecodeErr :: Relay {
2051
2051
err_msg : "Final Node OnionHopData provided for us as an intermediary node" ,
2052
- err_code : LocalHTLCFailureReason :: InvalidOnionPayload ,
2052
+ reason : LocalHTLCFailureReason :: InvalidOnionPayload ,
2053
2053
shared_secret,
2054
2054
trampoline_shared_secret : None ,
2055
2055
} )
@@ -2144,7 +2144,7 @@ where
2144
2144
if hop_data. intro_node_blinding_point . is_some ( ) {
2145
2145
return Err ( OnionDecodeErr :: Relay {
2146
2146
err_msg : "Non-final intro node Trampoline onion data provided to us as last hop" ,
2147
- err_code : LocalHTLCFailureReason :: InvalidOnionPayload ,
2147
+ reason : LocalHTLCFailureReason :: InvalidOnionPayload ,
2148
2148
shared_secret,
2149
2149
trampoline_shared_secret : Some ( SharedSecret :: from_bytes (
2150
2150
trampoline_shared_secret,
@@ -2153,14 +2153,14 @@ where
2153
2153
}
2154
2154
Err ( OnionDecodeErr :: Malformed {
2155
2155
err_msg : "Non-final Trampoline onion data provided to us as last hop" ,
2156
- err_code : LocalHTLCFailureReason :: InvalidOnionBlinding ,
2156
+ reason : LocalHTLCFailureReason :: InvalidOnionBlinding ,
2157
2157
} )
2158
2158
} ,
2159
2159
Ok ( ( msgs:: InboundTrampolinePayload :: BlindedReceive ( hop_data) , Some ( _) ) ) => {
2160
2160
if hop_data. intro_node_blinding_point . is_some ( ) {
2161
2161
return Err ( OnionDecodeErr :: Relay {
2162
2162
err_msg : "Final Trampoline intro node onion data provided to us as intermediate hop" ,
2163
- err_code : LocalHTLCFailureReason :: InvalidOnionPayload ,
2163
+ reason : LocalHTLCFailureReason :: InvalidOnionPayload ,
2164
2164
shared_secret,
2165
2165
trampoline_shared_secret : Some ( SharedSecret :: from_bytes (
2166
2166
trampoline_shared_secret,
@@ -2170,13 +2170,13 @@ where
2170
2170
Err ( OnionDecodeErr :: Malformed {
2171
2171
err_msg :
2172
2172
"Final Trampoline onion data provided to us as intermediate hop" ,
2173
- err_code : LocalHTLCFailureReason :: InvalidOnionBlinding ,
2173
+ reason : LocalHTLCFailureReason :: InvalidOnionBlinding ,
2174
2174
} )
2175
2175
} ,
2176
2176
Ok ( ( msgs:: InboundTrampolinePayload :: Forward ( _) , None ) ) => {
2177
2177
Err ( OnionDecodeErr :: Relay {
2178
2178
err_msg : "Non-final Trampoline onion data provided to us as last hop" ,
2179
- err_code : LocalHTLCFailureReason :: InvalidOnionPayload ,
2179
+ reason : LocalHTLCFailureReason :: InvalidOnionPayload ,
2180
2180
shared_secret,
2181
2181
trampoline_shared_secret : Some ( SharedSecret :: from_bytes (
2182
2182
trampoline_shared_secret,
@@ -2187,7 +2187,7 @@ where
2187
2187
Err ( OnionDecodeErr :: Relay {
2188
2188
err_msg :
2189
2189
"Final Trampoline onion data provided to us as intermediate hop" ,
2190
- err_code : LocalHTLCFailureReason :: InvalidOnionPayload ,
2190
+ reason : LocalHTLCFailureReason :: InvalidOnionPayload ,
2191
2191
shared_secret,
2192
2192
trampoline_shared_secret : Some ( SharedSecret :: from_bytes (
2193
2193
trampoline_shared_secret,
@@ -2201,12 +2201,12 @@ where
2201
2201
if blinding_point. is_some ( ) {
2202
2202
return Err ( OnionDecodeErr :: Malformed {
2203
2203
err_msg : "Intermediate Node OnionHopData provided for us as a final node" ,
2204
- err_code : LocalHTLCFailureReason :: InvalidOnionBlinding ,
2204
+ reason : LocalHTLCFailureReason :: InvalidOnionBlinding ,
2205
2205
} ) ;
2206
2206
}
2207
2207
Err ( OnionDecodeErr :: Relay {
2208
2208
err_msg : "Intermediate Node OnionHopData provided for us as a final node" ,
2209
- err_code : LocalHTLCFailureReason :: InvalidOnionPayload ,
2209
+ reason : LocalHTLCFailureReason :: InvalidOnionPayload ,
2210
2210
shared_secret,
2211
2211
trampoline_shared_secret : None ,
2212
2212
} )
@@ -2329,7 +2329,7 @@ fn decode_next_hop<T, R: ReadableArgs<T>, N: NextPacketBytes>(
2329
2329
if !fixed_time_eq ( & Hmac :: from_engine ( hmac) . to_byte_array ( ) , & hmac_bytes) {
2330
2330
return Err ( OnionDecodeErr :: Malformed {
2331
2331
err_msg : "HMAC Check failed" ,
2332
- err_code : LocalHTLCFailureReason :: InvalidOnionHMAC ,
2332
+ reason : LocalHTLCFailureReason :: InvalidOnionHMAC ,
2333
2333
} ) ;
2334
2334
}
2335
2335
@@ -2349,7 +2349,7 @@ fn decode_next_hop<T, R: ReadableArgs<T>, N: NextPacketBytes>(
2349
2349
} ;
2350
2350
return Err ( OnionDecodeErr :: Relay {
2351
2351
err_msg : "Unable to decode our hop data" ,
2352
- err_code : error_code,
2352
+ reason : error_code,
2353
2353
shared_secret : SharedSecret :: from_bytes ( shared_secret) ,
2354
2354
trampoline_shared_secret : None ,
2355
2355
} ) ;
@@ -2359,7 +2359,7 @@ fn decode_next_hop<T, R: ReadableArgs<T>, N: NextPacketBytes>(
2359
2359
if let Err ( _) = chacha_stream. read_exact ( & mut hmac[ ..] ) {
2360
2360
return Err ( OnionDecodeErr :: Relay {
2361
2361
err_msg : "Unable to decode our hop data" ,
2362
- err_code : LocalHTLCFailureReason :: InvalidOnionPayload ,
2362
+ reason : LocalHTLCFailureReason :: InvalidOnionPayload ,
2363
2363
shared_secret : SharedSecret :: from_bytes ( shared_secret) ,
2364
2364
trampoline_shared_secret : None ,
2365
2365
} ) ;
0 commit comments