@@ -3654,31 +3654,29 @@ impl<Signer: Sign, M: Deref, T: Deref, K: Deref, F: Deref, L: Deref> ChannelMana
3654
3654
3655
3655
true
3656
3656
} ) ;
3657
+ }
3657
3658
3658
- mem:: drop ( channel_state_lock) ;
3659
-
3660
- self . claimable_htlcs . lock ( ) . unwrap ( ) . retain ( |payment_hash, ( _, htlcs) | {
3661
- if htlcs. is_empty ( ) {
3662
- // This should be unreachable
3663
- debug_assert ! ( false ) ;
3659
+ self . claimable_htlcs . lock ( ) . unwrap ( ) . retain ( |payment_hash, ( _, htlcs) | {
3660
+ if htlcs. is_empty ( ) {
3661
+ // This should be unreachable
3662
+ debug_assert ! ( false ) ;
3663
+ return false ;
3664
+ }
3665
+ if let OnionPayload :: Invoice { .. } = htlcs[ 0 ] . onion_payload {
3666
+ // Check if we've received all the parts we need for an MPP (the value of the parts adds to total_msat).
3667
+ // In this case we're not going to handle any timeouts of the parts here.
3668
+ if htlcs[ 0 ] . total_msat == htlcs. iter ( ) . fold ( 0 , |total, htlc| total + htlc. value ) {
3669
+ return true ;
3670
+ } else if htlcs. into_iter ( ) . any ( |htlc| {
3671
+ htlc. timer_ticks += 1 ;
3672
+ return htlc. timer_ticks >= MPP_TIMEOUT_TICKS
3673
+ } ) {
3674
+ timed_out_mpp_htlcs. extend ( htlcs. into_iter ( ) . map ( |htlc| ( htlc. prev_hop . clone ( ) , payment_hash. clone ( ) ) ) ) ;
3664
3675
return false ;
3665
3676
}
3666
- if let OnionPayload :: Invoice { .. } = htlcs[ 0 ] . onion_payload {
3667
- // Check if we've received all the parts we need for an MPP (the value of the parts adds to total_msat).
3668
- // In this case we're not going to handle any timeouts of the parts here.
3669
- if htlcs[ 0 ] . total_msat == htlcs. iter ( ) . fold ( 0 , |total, htlc| total + htlc. value ) {
3670
- return true ;
3671
- } else if htlcs. into_iter ( ) . any ( |htlc| {
3672
- htlc. timer_ticks += 1 ;
3673
- return htlc. timer_ticks >= MPP_TIMEOUT_TICKS
3674
- } ) {
3675
- timed_out_mpp_htlcs. extend ( htlcs. into_iter ( ) . map ( |htlc| ( htlc. prev_hop . clone ( ) , payment_hash. clone ( ) ) ) ) ;
3676
- return false ;
3677
- }
3678
- }
3679
- true
3680
- } ) ;
3681
- }
3677
+ }
3678
+ true
3679
+ } ) ;
3682
3680
3683
3681
for htlc_source in timed_out_mpp_htlcs. drain ( ..) {
3684
3682
let receiver = HTLCDestination :: FailedPayment { payment_hash : htlc_source. 1 } ;
0 commit comments