Skip to content

routing: improve equal cost route comparison#3782

Merged
joostjager merged 1 commit intolightningnetwork:masterfrom
joostjager:zero-attempt-cost-prob
Dec 3, 2019
Merged

routing: improve equal cost route comparison#3782
joostjager merged 1 commit intolightningnetwork:masterfrom
joostjager:zero-attempt-cost-prob

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 requested a review from Roasbeef as a code owner December 2, 2019 08:22
@joostjager joostjager force-pushed the zero-attempt-cost-prob branch from 5193141 to ac70bd3 Compare December 2, 2019 08:25
@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?

@joostjager joostjager force-pushed the zero-attempt-cost-prob branch from ac70bd3 to 0772150 Compare December 2, 2019 13:23
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 force-pushed the zero-attempt-cost-prob branch from 0772150 to 3aaf32d Compare December 2, 2019 13:24
@joostjager
Copy link
Contributor Author

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

@joostjager joostjager requested a review from guggero December 2, 2019 13:24
@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