@@ -3796,31 +3796,29 @@ impl<M: Deref, T: Deref, K: Deref, F: Deref, L: Deref> ChannelManager<M, T, K, F
3796
3796
3797
3797
true
3798
3798
} ) ;
3799
+ }
3799
3800
3800
- mem:: drop ( channel_state_lock) ;
3801
-
3802
- self . claimable_htlcs . lock ( ) . unwrap ( ) . retain ( |payment_hash, ( _, htlcs) | {
3803
- if htlcs. is_empty ( ) {
3804
- // This should be unreachable
3805
- debug_assert ! ( false ) ;
3801
+ self . claimable_htlcs . lock ( ) . unwrap ( ) . retain ( |payment_hash, ( _, htlcs) | {
3802
+ if htlcs. is_empty ( ) {
3803
+ // This should be unreachable
3804
+ debug_assert ! ( false ) ;
3805
+ return false ;
3806
+ }
3807
+ if let OnionPayload :: Invoice { .. } = htlcs[ 0 ] . onion_payload {
3808
+ // Check if we've received all the parts we need for an MPP (the value of the parts adds to total_msat).
3809
+ // In this case we're not going to handle any timeouts of the parts here.
3810
+ if htlcs[ 0 ] . total_msat == htlcs. iter ( ) . fold ( 0 , |total, htlc| total + htlc. value ) {
3811
+ return true ;
3812
+ } else if htlcs. into_iter ( ) . any ( |htlc| {
3813
+ htlc. timer_ticks += 1 ;
3814
+ return htlc. timer_ticks >= MPP_TIMEOUT_TICKS
3815
+ } ) {
3816
+ timed_out_mpp_htlcs. extend ( htlcs. into_iter ( ) . map ( |htlc| ( htlc. prev_hop . clone ( ) , payment_hash. clone ( ) ) ) ) ;
3806
3817
return false ;
3807
3818
}
3808
- if let OnionPayload :: Invoice { .. } = htlcs[ 0 ] . onion_payload {
3809
- // Check if we've received all the parts we need for an MPP (the value of the parts adds to total_msat).
3810
- // In this case we're not going to handle any timeouts of the parts here.
3811
- if htlcs[ 0 ] . total_msat == htlcs. iter ( ) . fold ( 0 , |total, htlc| total + htlc. value ) {
3812
- return true ;
3813
- } else if htlcs. into_iter ( ) . any ( |htlc| {
3814
- htlc. timer_ticks += 1 ;
3815
- return htlc. timer_ticks >= MPP_TIMEOUT_TICKS
3816
- } ) {
3817
- timed_out_mpp_htlcs. extend ( htlcs. into_iter ( ) . map ( |htlc| ( htlc. prev_hop . clone ( ) , payment_hash. clone ( ) ) ) ) ;
3818
- return false ;
3819
- }
3820
- }
3821
- true
3822
- } ) ;
3823
- }
3819
+ }
3820
+ true
3821
+ } ) ;
3824
3822
3825
3823
for htlc_source in timed_out_mpp_htlcs. drain ( ..) {
3826
3824
let receiver = HTLCDestination :: FailedPayment { payment_hash : htlc_source. 1 } ;
0 commit comments