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

routing: improve equal cost route comparison #3782

Merged

Conversation

joostjager
Copy link
Collaborator

@joostjager joostjager commented Dec 2, 2019

When the (virtual) payment attempt cost is set to zero, probabilities are no longer a factor in determining the best route. In case of routes with equal costs, we'd just go with the first one found. This commit refines this behavior by picking the route with the highest probability. So even though probability doesn't affect the route cost, it is still used as a tie breaker.

@joostjager joostjager requested a review from Roasbeef as a code owner Dec 2, 2019
@joostjager joostjager self-assigned this Dec 2, 2019
@joostjager joostjager added payments routing v0.9.0 labels Dec 2, 2019
@joostjager joostjager added this to WIP in v0.9.0-beta via automation Dec 2, 2019
@joostjager joostjager added this to the 0.9.0 milestone Dec 2, 2019
@joostjager joostjager requested review from guggero and wpaulino and removed request for Roasbeef Dec 2, 2019
guggero
guggero approved these changes Dec 2, 2019
Copy link
Collaborator

@guggero guggero left a comment

Nice, looks good to me!
Is it maybe worth adding a test for this? Or is this too trivial a change?

routing/pathfind.go Outdated Show resolved Hide resolved
When the (virtual) payment attempt cost is set to zero, probabilities
are no longer a factor in determining the best route. In case of routes
with equal costs, we'd just go with the first one found. This commit
refines this behavior by picking the route with the highest probability.
So even though probability doesn't affect the route cost, it is still
used as a tie breaker.
@joostjager
Copy link
Collaborator Author

@joostjager joostjager commented Dec 2, 2019

Test added. Also ran into the heap comparison, which I updated as well.

@joostjager joostjager requested a review from guggero Dec 2, 2019
guggero
guggero approved these changes Dec 2, 2019
v0.9.0-beta automation moved this from WIP to Approved Dec 2, 2019
@joostjager joostjager merged commit db21c39 into lightningnetwork:master Dec 3, 2019
2 checks passed
v0.9.0-beta automation moved this from Approved to Done Dec 3, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
payments routing v0.9.0
Projects
No open projects
v0.9.0-beta
  
Done
Development

Successfully merging this pull request may close these issues.

None yet

3 participants