@@ -3673,31 +3673,29 @@ impl<M: Deref, T: Deref, K: Deref, F: Deref, L: Deref> ChannelManager<M, T, K, F
3673
3673
3674
3674
true
3675
3675
} ) ;
3676
+ }
3676
3677
3677
- mem:: drop ( channel_state_lock) ;
3678
-
3679
- self . claimable_htlcs . lock ( ) . unwrap ( ) . retain ( |payment_hash, ( _, htlcs) | {
3680
- if htlcs. is_empty ( ) {
3681
- // This should be unreachable
3682
- debug_assert ! ( false ) ;
3678
+ self . claimable_htlcs . lock ( ) . unwrap ( ) . retain ( |payment_hash, ( _, htlcs) | {
3679
+ if htlcs. is_empty ( ) {
3680
+ // This should be unreachable
3681
+ debug_assert ! ( false ) ;
3682
+ return false ;
3683
+ }
3684
+ if let OnionPayload :: Invoice { .. } = htlcs[ 0 ] . onion_payload {
3685
+ // Check if we've received all the parts we need for an MPP (the value of the parts adds to total_msat).
3686
+ // In this case we're not going to handle any timeouts of the parts here.
3687
+ if htlcs[ 0 ] . total_msat == htlcs. iter ( ) . fold ( 0 , |total, htlc| total + htlc. value ) {
3688
+ return true ;
3689
+ } else if htlcs. into_iter ( ) . any ( |htlc| {
3690
+ htlc. timer_ticks += 1 ;
3691
+ return htlc. timer_ticks >= MPP_TIMEOUT_TICKS
3692
+ } ) {
3693
+ timed_out_mpp_htlcs. extend ( htlcs. into_iter ( ) . map ( |htlc| ( htlc. prev_hop . clone ( ) , payment_hash. clone ( ) ) ) ) ;
3683
3694
return false ;
3684
3695
}
3685
- if let OnionPayload :: Invoice { .. } = htlcs[ 0 ] . onion_payload {
3686
- // Check if we've received all the parts we need for an MPP (the value of the parts adds to total_msat).
3687
- // In this case we're not going to handle any timeouts of the parts here.
3688
- if htlcs[ 0 ] . total_msat == htlcs. iter ( ) . fold ( 0 , |total, htlc| total + htlc. value ) {
3689
- return true ;
3690
- } else if htlcs. into_iter ( ) . any ( |htlc| {
3691
- htlc. timer_ticks += 1 ;
3692
- return htlc. timer_ticks >= MPP_TIMEOUT_TICKS
3693
- } ) {
3694
- timed_out_mpp_htlcs. extend ( htlcs. into_iter ( ) . map ( |htlc| ( htlc. prev_hop . clone ( ) , payment_hash. clone ( ) ) ) ) ;
3695
- return false ;
3696
- }
3697
- }
3698
- true
3699
- } ) ;
3700
- }
3696
+ }
3697
+ true
3698
+ } ) ;
3701
3699
3702
3700
for htlc_source in timed_out_mpp_htlcs. drain ( ..) {
3703
3701
let receiver = HTLCDestination :: FailedPayment { payment_hash : htlc_source. 1 } ;
0 commit comments