Skip to content

Commit def417c

Browse files
committed
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! Signed-off-by: Rusty Russell <[email protected]> Changelog-EXPERIMENTAL: `askrene` is now better at finding low-fee paths.
1 parent 94f8af9 commit def417c

File tree

2 files changed

+7
-4
lines changed

2 files changed

+7
-4
lines changed

plugins/askrene/askrene.c

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -409,8 +409,8 @@ static const char *get_routes(const tal_t *ctx,
409409

410410
delay_feefactor = 1.0/1000000;
411411

412-
/* First up, don't care about fees. */
413-
mu = 0;
412+
/* First up, don't care about fees (well, just enough to tiebreak!) */
413+
mu = 1;
414414
flows = minflow(rq, rq, srcnode, dstnode, amount,
415415
mu, delay_feefactor);
416416
if (!flows) {
@@ -445,7 +445,10 @@ static const char *get_routes(const tal_t *ctx,
445445
while (amount_msat_greater(flowset_fee(rq->plugin, flows), maxfee)) {
446446
struct flow **new_flows;
447447

448-
mu += 10;
448+
if (mu == 1)
449+
mu = 10;
450+
else
451+
mu += 10;
449452
rq_log(tmpctx, rq, LOG_UNUSUAL,
450453
"The flows had a fee of %s, greater than max of %s, retrying with mu of %u%%...",
451454
fmt_amount_msat(tmpctx, flowset_fee(rq->plugin, flows)),

tests/test_askrene.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -992,4 +992,4 @@ def test_real_data(node_factory, bitcoind):
992992
if len(fees[n]) > len(fees[best]):
993993
best = n
994994

995-
assert (len(fees[best]), len(improved), total_first_fee, total_final_fee, percent_fee_reduction) == (10, 96, 19677199, 585496, 98)
995+
assert (len(fees[best]), len(improved), total_first_fee, total_final_fee, percent_fee_reduction) == (10, 96, 13891668, 585496, 96)

0 commit comments

Comments
 (0)