Skip to content

Commit c34a4a9

Browse files
committed
Account for leftover fee budget when retrying PartialFailures
1 parent 233a8b2 commit c34a4a9

File tree

1 file changed

+7
-1
lines changed

1 file changed

+7
-1
lines changed

lightning/src/ln/outbound_payment.rs

+7-1
Original file line numberDiff line numberDiff line change
@@ -1075,8 +1075,14 @@ impl OutboundPayments {
10751075
payment_id,
10761076
failed_paths_retry: if pending_amt_unsent != 0 {
10771077
if let Some(payment_params) = &route.payment_params {
1078+
let mut payment_params = payment_params.clone();
1079+
// We calculate the leftover fee budget we're allowed to spend by
1080+
// subtracting the used fee from the total fee budget.
1081+
payment_params.max_total_routing_fee_msat = payment_params
1082+
.max_total_routing_fee_msat.map(|m| m.saturating_sub(route.get_total_fees()));
1083+
10781084
Some(RouteParameters {
1079-
payment_params: payment_params.clone(),
1085+
payment_params,
10801086
final_value_msat: pending_amt_unsent,
10811087
})
10821088
} else { None }

0 commit comments

Comments
 (0)