Skip to content

Askrene: fees get its probability cost - #9723

Open
Lagrang3 wants to merge 2 commits into
ElementsProject:masterfrom
Lagrang3:askrene-fee-headroom
Open

Lagrang3 wants to merge 2 commits into
ElementsProject:masterfrom
Lagrang3:askrene-fee-headroom

Conversation

@Lagrang3

@Lagrang3 Lagrang3 commented Nov 9, 2026 •

Copy link
Copy Markdown
Collaborator

We modify the probability cost function to make it compute approximately the probability cost of probability(flow + fees),
previously we only did probability(flow). The effects are: some capacity is reserved for fees and we obtain better
near optimal solutions.

This PR is the first part of #9380, because the change deserves its own PR.

@Lagrang3 Lagrang3 added this to the v26.12 milestone Nov 9, 2026
@Lagrang3
Lagrang3 force-pushed the askrene-fee-headroom branch 2 times, most recently from bb0585c to 9e45d47 Compare November 9, 2026 17:01

@ksedgwic ksedgwic left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Concept ACK. The derivation in the comment is correct, and scaling both bounds by amount / (amount + maxfee) is the refinement suggested in #9380. Inline: one behaviour change for payments near the full balance of a local channel, a test gap, and four small items.

Comment thread plugins/askrene/child/mcf.c Resolved
Comment thread tests/test_askrene.py Resolved
Comment thread plugins/askrene/child/mcf.c Resolved
Comment thread plugins/askrene/child/mcf.c Resolved
Comment thread plugins/askrene/child/mcf.c Resolved
Comment thread plugins/askrene/child/mcf.c Resolved
Even if refine does the job of adjusting the fee+amount to fit the
known_max in a channel, the flow probability computation does not
consider the eventual fees that a flow might carry.

Changelog-None

Signed-off-by: Lagrang3 <lagrang3@protonmail.com>
When the known max and known min are about the same value, the
probability cost of sending x=value is zero and MCF will try it.
It doesn't take into account the possibility that when we hit that
channel the actual flow is x+fees. We adjust the min/max bounds
by a factor of x/(x+fee) which effectively introduces headroom for fees.

Changelog-Fixed: askrene-getroutes: Account for fees in the flow amount when computing probability costs.

Signed-off-by: Lagrang3 <lagrang3@protonmail.com>
@Lagrang3
Lagrang3 force-pushed the askrene-fee-headroom branch from ea7b2b8 to c721134 Compare November 12, 2026 08:32
@Lagrang3
Lagrang3 requested a review from ksedgwic November 12, 2026 08:32

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants