diff --git a/plugins/askrene/refine.c b/plugins/askrene/refine.c index f790e00c0..d68027094 100644 --- a/plugins/askrene/refine.c +++ b/plugins/askrene/refine.c @@ -445,8 +445,18 @@ static bool increase_flows(const struct route_query *rq, if (amount_msat_greater(capacity, ceiling[i])) capacity = ceiling[i]; - if (!amount_msat_sub(&remaining, capacity, flows[i]->delivers)) - abort(); + /* We've had a report that this subtract can fail: + * that implies we've pushed a flow past its estimated + * capacity. That shouldn't happen, but if it does, + * we don't crash */ + if (!amount_msat_sub(&remaining, capacity, flows[i]->delivers)) { + rq_log(rq, rq, LOG_BROKEN, + "%s: flow %s delivers %s which is more than the path's capacity %s", __func__, + fmt_flow_full(tmpctx, rq, flows[i]), + fmt_amount_msat(tmpctx, flows[i]->delivers), + fmt_amount_msat(tmpctx, capacity)); + continue; + } if (amount_msat_greater(remaining, best_remaining)) { best_flownum = i; best_remaining = remaining;