Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

askrene: detect and cancel flow cycles #14

Open
wants to merge 1 commit into
base: askrene-bug
Choose a base branch
from

Conversation

Lagrang3
Copy link

@Lagrang3 Lagrang3 commented Oct 4, 2024

Flow cycles can occur if we have zero arc costs.
The previous path construction from the flow in the network assumed the absence of
such cycles and would enter an infinite loop if it hit one.

With his patch we add cycle detection and removal during the path construction phase.

Reported-by: Rusty Russell rusty@rustcorp.com.au

@Lagrang3
Copy link
Author

Lagrang3 commented Oct 4, 2024

I think this is roughly what we need: detect cycles and remove them.
Another option is to ensure that there are no zero cost arcs ... I am not sure that would be the right choice.

I leave it as a draft today because it fails the tests. Clearly I made a mistake somewhere.
The logic branch when we match a source and a sink node is pretty much the same code we had before.
However, the function that erases cycles is not yet tested.

Flow cycles can occur if we have arc zero arc costs.
The previous path construction from the flow in the network assumed the
absence of such cycles and would enter an infinite loop if it hit one.

With his patch wee add cycle detection and removal during the path
construction phase.

Reported-by: Rusty Russell <rusty@rustcorp.com.au>
Signed-off-by: Lagrang3 <lagrang3@protonmail.com>
@Lagrang3 Lagrang3 marked this pull request as ready for review October 6, 2024 17:40
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.

1 participant