diff --git a/plugins/askrene/child/mcf.c b/plugins/askrene/child/mcf.c index 3842c9492b6e..7d03c5b1e0c7 100644 --- a/plugins/askrene/child/mcf.c +++ b/plugins/askrene/child/mcf.c @@ -1507,6 +1507,10 @@ linear_routes(const tal_t *ctx, struct route_query *rq, { /* Almost 1 to limit the dials' iterations. */ const double near_one = 1. - 1e-6; + /* A cut-off at 0.99 avoids excessive iterations in the + * diminishing-returns range above 0.95 where solver runs become + * slower and fee improvements stagnate or degrade (issue #9726). */ + const double max_mu = 0.99; const tal_t *working_ctx = tal(ctx, tal_t); const char *error_message; struct amount_msat amount_to_deliver = amount; @@ -1710,7 +1714,7 @@ linear_routes(const tal_t *ctx, struct route_query *rq, goto fail; } if (amount_msat_greater(all_fees, partial_feebudget)) { - if (mu < near_one) { + if (mu < max_mu) { /* all_fees exceed the strong budget limit, try * to fix it increasing mu. */ mu *= 2; diff --git a/tests/test_askrene.py b/tests/test_askrene.py index fc8515256e2c..2e77f24d9745 100644 --- a/tests/test_askrene.py +++ b/tests/test_askrene.py @@ -2314,6 +2314,11 @@ def test_excessive_fee_cost(node_factory): maxparts=1, ) + # Dial iterations cut off once mu >= 0.99, bounding solver runs (issue #9726) + l1.daemon.logs_catchup() + mu_retries = [l for l in l1.daemon.logs if "retrying with mu of" in l] + assert 0 < len(mu_retries) <= 15 + def check_getroute_routes( node,