askrene: don't *completely* ignore fees to start.

I noticed that increasing mu a little bit sometimes made a big difference,
because by completely ignoring fees we were choosing the worst of two channels
in some cases.

Start at 1% fees; this saves a lot on initial fees in this test!

Here's the new stats on mu levels:

     96  mu=1
     90  mu=10
     41  mu=20
     30  mu=30
     24  mu=40
     19  mu=50
     22  mu=60
      8  mu=70
     95  mu=80
     19  mu=90

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
Changelog-EXPERIMENTAL: `askrene` is now better at finding low-fee paths.
This commit is contained in:
Rusty Russell 2024-10-12 17:23:42 +10:30
parent 2a0f09fc2d
commit bcc8bd59c8
2 changed files with 7 additions and 4 deletions

View file

@ -399,8 +399,8 @@ static const char *get_routes(const tal_t *ctx,
delay_feefactor = 1.0/1000000;
/* First up, don't care about fees. */
mu = 0;
/* First up, don't care about fees (well, just enough to tiebreak!) */
mu = 1;
flows = minflow(rq, rq, srcnode, dstnode, amount,
mu, delay_feefactor);
if (!flows) {
@ -435,7 +435,10 @@ too_expensive:
while (amount_msat_greater(flowset_fee(rq->plugin, flows), maxfee)) {
struct flow **new_flows;
mu += 10;
if (mu == 1)
mu = 10;
else
mu += 10;
rq_log(tmpctx, rq, LOG_UNUSUAL,
"The flows had a fee of %s, greater than max of %s, retrying with mu of %u%%...",
fmt_amount_msat(tmpctx, flowset_fee(rq->plugin, flows)),

View file

@ -992,4 +992,4 @@ def test_real_data(node_factory, bitcoind):
if len(fees[n]) > len(fees[best]):
best = n
assert (len(fees[best]), len(improved), total_first_fee, total_final_fee, percent_fee_reduction) == (8, 95, 19384459, 564997, 98)
assert (len(fees[best]), len(improved), total_first_fee, total_final_fee, percent_fee_reduction) == (8, 95, 6007785, 564997, 91)