@@ -2277,12 +2277,9 @@ impl<Signer: Sign, M: Deref, T: Deref, K: Deref, F: Deref, L: Deref> ChannelMana
2277
2277
// we got all the HTLCs and then a channel closed while we were waiting for the user to
2278
2278
// provide the preimage, so worrying too much about the optimal handling isn't worth
2279
2279
// it.
2280
-
2281
- let is_mpp = true ;
2282
2280
let mut valid_mpp = sources[ 0 ] . payment_data . total_msat >= expected_amount;
2283
-
2284
2281
for htlc in sources. iter ( ) {
2285
- if !is_mpp || ! valid_mpp { break ; }
2282
+ if !valid_mpp { break ; }
2286
2283
if let None = channel_state. as_ref ( ) . unwrap ( ) . short_to_id . get ( & htlc. prev_hop . short_channel_id ) {
2287
2284
valid_mpp = false ;
2288
2285
}
@@ -2291,8 +2288,8 @@ impl<Signer: Sign, M: Deref, T: Deref, K: Deref, F: Deref, L: Deref> ChannelMana
2291
2288
let mut errs = Vec :: new ( ) ;
2292
2289
let mut claimed_any_htlcs = false ;
2293
2290
for htlc in sources. drain ( ..) {
2294
- if channel_state . is_none ( ) { channel_state = Some ( self . channel_state . lock ( ) . unwrap ( ) ) ; }
2295
- if ( is_mpp && !valid_mpp ) || ( !is_mpp && ( htlc . value < expected_amount || htlc . value > expected_amount * 2 ) ) {
2291
+ if !valid_mpp {
2292
+ if channel_state . is_none ( ) { channel_state = Some ( self . channel_state . lock ( ) . unwrap ( ) ) ; }
2296
2293
let mut htlc_msat_height_data = byte_utils:: be64_to_array ( htlc. value ) . to_vec ( ) ;
2297
2294
htlc_msat_height_data. extend_from_slice ( & byte_utils:: be32_to_array (
2298
2295
self . best_block . read ( ) . unwrap ( ) . height ( ) ) ) ;
@@ -2309,10 +2306,7 @@ impl<Signer: Sign, M: Deref, T: Deref, K: Deref, F: Deref, L: Deref> ChannelMana
2309
2306
claimed_any_htlcs = true ;
2310
2307
} else { errs. push ( e) ; }
2311
2308
} ,
2312
- Err ( None ) if is_mpp => unreachable ! ( "We already checked for channel existence, we can't fail here!" ) ,
2313
- Err ( None ) => {
2314
- log_warn ! ( self . logger, "Channel we expected to claim an HTLC from was closed." ) ;
2315
- } ,
2309
+ Err ( None ) => unreachable ! ( "We already checked for channel existence, we can't fail here!" ) ,
2316
2310
Ok ( ( ) ) => claimed_any_htlcs = true ,
2317
2311
}
2318
2312
}
0 commit comments