@@ -3548,7 +3548,7 @@ where
3548
3548
}
3549
3549
3550
3550
macro_rules! check_total_value {
3551
- ( $payment_secret: expr, $payment_preimage: expr, $total_msat : expr , $ is_keysend: expr) => { {
3551
+ ( $payment_secret: expr, $payment_preimage: expr, $is_keysend: expr) => { {
3552
3552
let mut payment_claimable_generated = false ;
3553
3553
let purpose = if $is_keysend {
3554
3554
events:: PaymentPurpose :: SpontaneousPayment (
@@ -3596,9 +3596,9 @@ where
3596
3596
for htlc in htlcs. iter( ) {
3597
3597
total_value += htlc. sender_intended_value;
3598
3598
earliest_expiry = cmp:: min( earliest_expiry, htlc. cltv_expiry) ;
3599
- if htlc. total_msat != $ total_msat {
3599
+ if htlc. total_msat != claimable_htlc . total_msat {
3600
3600
log_trace!( self . logger, "Failing HTLCs with payment_hash {} as the HTLCs had inconsistent total values (eg {} and {})" ,
3601
- log_bytes!( payment_hash. 0 ) , $ total_msat, htlc. total_msat) ;
3601
+ log_bytes!( payment_hash. 0 ) , claimable_htlc . total_msat, htlc. total_msat) ;
3602
3602
total_value = msgs:: MAX_VALUE_MSAT ;
3603
3603
}
3604
3604
if total_value >= msgs:: MAX_VALUE_MSAT { break ; }
@@ -3607,11 +3607,11 @@ where
3607
3607
// match exactly the condition used in `timer_tick_occurred`
3608
3608
if total_value >= msgs:: MAX_VALUE_MSAT {
3609
3609
fail_htlc!( claimable_htlc, payment_hash) ;
3610
- } else if total_value - claimable_htlc. sender_intended_value >= $ total_msat {
3610
+ } else if total_value - claimable_htlc. sender_intended_value >= claimable_htlc . total_msat {
3611
3611
log_trace!( self . logger, "Failing HTLC with payment_hash {} as payment is already claimable" ,
3612
3612
log_bytes!( payment_hash. 0 ) ) ;
3613
3613
fail_htlc!( claimable_htlc, payment_hash) ;
3614
- } else if total_value >= $ total_msat {
3614
+ } else if total_value >= claimable_htlc . total_msat {
3615
3615
#[ allow( unused_assignments) ] {
3616
3616
committed_to_claimable = true ;
3617
3617
}
@@ -3670,10 +3670,10 @@ where
3670
3670
fail_htlc ! ( claimable_htlc, payment_hash) ;
3671
3671
}
3672
3672
}
3673
- check_total_value ! ( Some ( payment_data. payment_secret) , payment_preimage, payment_data . total_msat , false ) ;
3673
+ check_total_value ! ( Some ( payment_data. payment_secret) , payment_preimage, false ) ;
3674
3674
} ,
3675
3675
OnionPayload :: Spontaneous ( preimage) => {
3676
- check_total_value ! ( payment_data. as_ref( ) . map( |d| d. payment_secret) , Some ( preimage) , payment_data . as_ref ( ) . map_or ( claimable_htlc . value , |d| d . total_msat ) , true ) ;
3676
+ check_total_value ! ( payment_data. as_ref( ) . map( |d| d. payment_secret) , Some ( preimage) , true ) ;
3677
3677
}
3678
3678
}
3679
3679
} ,
@@ -3691,7 +3691,7 @@ where
3691
3691
log_bytes!( payment_hash. 0 ) , payment_data. total_msat, inbound_payment. get( ) . min_value_msat. unwrap( ) ) ;
3692
3692
fail_htlc ! ( claimable_htlc, payment_hash) ;
3693
3693
} else {
3694
- let payment_claimable_generated = check_total_value ! ( Some ( payment_data. payment_secret) , inbound_payment. get( ) . payment_preimage, payment_data . total_msat , false ) ;
3694
+ let payment_claimable_generated = check_total_value ! ( Some ( payment_data. payment_secret) , inbound_payment. get( ) . payment_preimage, false ) ;
3695
3695
if payment_claimable_generated {
3696
3696
inbound_payment. remove_entry ( ) ;
3697
3697
}
0 commit comments