@@ -2314,12 +2314,9 @@ impl<Signer: Sign, M: Deref, T: Deref, K: Deref, F: Deref, L: Deref> ChannelMana
2314
2314
// we got all the HTLCs and then a channel closed while we were waiting for the user to
2315
2315
// provide the preimage, so worrying too much about the optimal handling isn't worth
2316
2316
// it.
2317
-
2318
- let is_mpp = true ;
2319
2317
let mut valid_mpp = sources[ 0 ] . payment_data . total_msat >= expected_amount;
2320
-
2321
2318
for htlc in sources. iter ( ) {
2322
- if !is_mpp || ! valid_mpp { break ; }
2319
+ if !valid_mpp { break ; }
2323
2320
if let None = channel_state. as_ref ( ) . unwrap ( ) . short_to_id . get ( & htlc. prev_hop . short_channel_id ) {
2324
2321
valid_mpp = false ;
2325
2322
}
@@ -2328,8 +2325,8 @@ impl<Signer: Sign, M: Deref, T: Deref, K: Deref, F: Deref, L: Deref> ChannelMana
2328
2325
let mut errs = Vec :: new ( ) ;
2329
2326
let mut claimed_any_htlcs = false ;
2330
2327
for htlc in sources. drain ( ..) {
2331
- if channel_state . is_none ( ) { channel_state = Some ( self . channel_state . lock ( ) . unwrap ( ) ) ; }
2332
- if ( is_mpp && !valid_mpp ) || ( !is_mpp && ( htlc . value < expected_amount || htlc . value > expected_amount * 2 ) ) {
2328
+ if !valid_mpp {
2329
+ if channel_state . is_none ( ) { channel_state = Some ( self . channel_state . lock ( ) . unwrap ( ) ) ; }
2333
2330
let mut htlc_msat_height_data = byte_utils:: be64_to_array ( htlc. value ) . to_vec ( ) ;
2334
2331
htlc_msat_height_data. extend_from_slice ( & byte_utils:: be32_to_array (
2335
2332
self . best_block . read ( ) . unwrap ( ) . height ( ) ) ) ;
@@ -2346,10 +2343,7 @@ impl<Signer: Sign, M: Deref, T: Deref, K: Deref, F: Deref, L: Deref> ChannelMana
2346
2343
claimed_any_htlcs = true ;
2347
2344
} else { errs. push ( e) ; }
2348
2345
} ,
2349
- Err ( None ) if is_mpp => unreachable ! ( "We already checked for channel existence, we can't fail here!" ) ,
2350
- Err ( None ) => {
2351
- log_warn ! ( self . logger, "Channel we expected to claim an HTLC from was closed." ) ;
2352
- } ,
2346
+ Err ( None ) => unreachable ! ( "We already checked for channel existence, we can't fail here!" ) ,
2353
2347
Ok ( ( ) ) => claimed_any_htlcs = true ,
2354
2348
}
2355
2349
}
0 commit comments