@@ -1099,18 +1099,20 @@ impl OutboundPayments {
1099
1099
}
1100
1100
}
1101
1101
}
1102
- let ( total_msat, recipient_onion, keysend_preimage, onion_session_privs) = {
1102
+ let total_msat = route_params. final_value_msat ;
1103
+ let ( recipient_onion, keysend_preimage, onion_session_privs) = {
1103
1104
let mut outbounds = self . pending_outbound_payments . lock ( ) . unwrap ( ) ;
1104
1105
match outbounds. entry ( payment_id) {
1105
1106
hash_map:: Entry :: Occupied ( mut payment) => {
1106
1107
match payment. get ( ) {
1107
1108
PendingOutboundPayment :: Retryable {
1108
- total_msat, keysend_preimage, payment_secret, payment_metadata,
1109
+ total_msat : retryable_total_msat , keysend_preimage, payment_secret, payment_metadata,
1109
1110
custom_tlvs, pending_amt_msat, ..
1110
1111
} => {
1112
+ debug_assert_eq ! ( total_msat, * retryable_total_msat) ;
1111
1113
const RETRY_OVERFLOW_PERCENTAGE : u64 = 10 ;
1112
1114
let retry_amt_msat = route. get_total_amount ( ) ;
1113
- if retry_amt_msat + * pending_amt_msat > * total_msat * ( 100 + RETRY_OVERFLOW_PERCENTAGE ) / 100 {
1115
+ if retry_amt_msat + * pending_amt_msat > total_msat * ( 100 + RETRY_OVERFLOW_PERCENTAGE ) / 100 {
1114
1116
log_error ! ( logger, "retry_amt_msat of {} will put pending_amt_msat (currently: {}) more than 10% over total_payment_amt_msat of {}" , retry_amt_msat, pending_amt_msat, total_msat) ;
1115
1117
abandon_with_entry ! ( payment, PaymentFailureReason :: UnexpectedError ) ;
1116
1118
return
@@ -1122,7 +1124,6 @@ impl OutboundPayments {
1122
1124
return
1123
1125
}
1124
1126
1125
- let total_msat = * total_msat;
1126
1127
let recipient_onion = RecipientOnionFields {
1127
1128
payment_secret : * payment_secret,
1128
1129
payment_metadata : payment_metadata. clone ( ) ,
@@ -1141,7 +1142,7 @@ impl OutboundPayments {
1141
1142
1142
1143
payment. get_mut ( ) . increment_attempts ( ) ;
1143
1144
1144
- ( total_msat , recipient_onion, keysend_preimage, onion_session_privs)
1145
+ ( recipient_onion, keysend_preimage, onion_session_privs)
1145
1146
} ,
1146
1147
PendingOutboundPayment :: Legacy { .. } => {
1147
1148
log_error ! ( logger, "Unable to retry payments that were initially sent on LDK versions prior to 0.0.102" ) ;
@@ -1152,7 +1153,6 @@ impl OutboundPayments {
1152
1153
return
1153
1154
} ,
1154
1155
PendingOutboundPayment :: InvoiceReceived { payment_hash, retry_strategy, .. } => {
1155
- let total_amount = route_params. final_value_msat ;
1156
1156
let recipient_onion = RecipientOnionFields {
1157
1157
payment_secret : None ,
1158
1158
payment_metadata : None ,
@@ -1165,7 +1165,7 @@ impl OutboundPayments {
1165
1165
retry_strategy, payment_params, entropy_source, best_block_height
1166
1166
) ;
1167
1167
* payment. into_mut ( ) = retryable_payment;
1168
- ( total_amount , recipient_onion, None , onion_session_privs)
1168
+ ( recipient_onion, None , onion_session_privs)
1169
1169
} ,
1170
1170
PendingOutboundPayment :: StaticInvoiceReceived { .. } => todo ! ( ) ,
1171
1171
PendingOutboundPayment :: Fulfilled { .. } => {
0 commit comments