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
Contributor

@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 self-assigned this Dec 2, 2019
@joostjager joostjager added payments Related to invoices/payments routing v0.9.0 labels 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 December 2, 2019 08:26
Copy link
Collaborator

@guggero guggero left a comment

Choose a reason for hiding this comment

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

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
Contributor Author

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

@joostjager joostjager merged commit db21c39 into lightningnetwork:master Dec 3, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
payments Related to invoices/payments routing
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants