@@ -2261,33 +2261,16 @@ impl MaybeReadable for Event {
2261
2261
( 2 , failure_type_opt, upgradable_required) ,
2262
2262
} ) ;
2263
2263
2264
- let event = Event :: HTLCHandlingFailed {
2265
- prev_channel_id,
2266
- failure_type : _init_tlv_based_struct_field ! ( failure_type_opt, upgradable_required) ,
2267
- failure_reason,
2268
- } ;
2269
-
2270
2264
// If a legacy HTLCHandlingFailureType::UnknownNextHop was written, upgrade
2271
2265
// it to its new representation, otherwise leave unchanged.
2272
- Ok ( Some ( match event {
2273
- Event :: HTLCHandlingFailed { prev_channel_id, ref failure_type, ref failure_reason } => {
2274
- match failure_type {
2275
- HTLCHandlingFailureType :: UnknownNextHop { requested_forward_scid } => {
2276
- debug_assert ! ( failure_reason. is_none( ) ,
2277
- "new failure reason should not be written with legacy UnknownNextHop type" ) ;
2278
-
2279
- Event :: HTLCHandlingFailed {
2280
- prev_channel_id,
2281
- failure_type : HTLCHandlingFailureType :: InvalidForward {
2282
- requested_forward_scid : * requested_forward_scid,
2283
- } ,
2284
- failure_reason : Some ( LocalHTLCFailureReason :: UnknownNextPeer . into ( ) ) ,
2285
- }
2286
- }
2287
- _ => event,
2288
- }
2289
- } ,
2290
- _ => panic ! ( "Event::HTLCHandlingFailed type incorrect" ) ,
2266
+ if let Some ( HTLCHandlingFailureType :: UnknownNextHop { requested_forward_scid } ) = failure_type_opt. 0 {
2267
+ failure_type_opt. 0 = Some ( HTLCHandlingFailureType :: InvalidForward { requested_forward_scid } ) ;
2268
+ failure_reason = Some ( LocalHTLCFailureReason :: UnknownNextPeer . into ( ) ) ;
2269
+ }
2270
+ Ok ( Some ( Event :: HTLCHandlingFailed {
2271
+ prev_channel_id,
2272
+ failure_type : _init_tlv_based_struct_field ! ( failure_type_opt, upgradable_required) ,
2273
+ failure_reason
2291
2274
} ) )
2292
2275
} ;
2293
2276
f ( )
0 commit comments