Use correct cost comparison when evaluating candidate channels#1090
Use correct cost comparison when evaluating candidate channels#1090
Conversation
…ng is within th range htlcMinimumMsat/htlcMaximumMsat of the candidate channel
Codecov Report
@@ Coverage Diff @@
## master #1090 +/- ##
==========================================
+ Coverage 82.64% 82.79% +0.14%
==========================================
Files 101 101
Lines 7652 7653 +1
Branches 312 312
==========================================
+ Hits 6324 6336 +12
+ Misses 1328 1317 -11
|
| // test for ignored edges | ||
| if (edge.update.htlcMaximumMsat.forall(newMinimumKnownWeight.cost + amountMsat <= _) && | ||
| newMinimumKnownWeight.cost + amountMsat >= edge.update.htlcMinimumMsat && | ||
| if (edge.update.htlcMaximumMsat.forall(newMinimumKnownWeight.cost <= _) && |
There was a problem hiding this comment.
If amountMsat is not used here then it's not used at all in dijkstraShortestPath and should be removed from the parameter list. We then need to make sure that
There was a problem hiding this comment.
With this change dijkstraShortestPath will use only the cost found in the initialWeight parameter which is RichWeight(amountMsat, 0, 0, 0) for the initial step and when calculating the 'spurPath' for an alternative path this is the result of pathWeight so it's the cost to go from the starting node to this intermediate node (from here the algorithm will search for a different path). I will remove amountMsat from the parameter list.
There was a problem hiding this comment.
f62f472 removes the unused parameter and also extracts the initialWeight parameter in the first invocation of dijkstraShortestPath, for more readability.
…eight in the first step of 'yenKshortestPaths'
This PR fixes bug ACINQ/eclair-mobile#207 which was caused by an incorrect channel cost evaluation against its
htlcMaximumMsat. The fix is to consider the correct channel cost.