routing: penalize node-level failures harder

Previously we only penalized the outgoing connections of a failing node.
This turned out not to be sufficient, because the next route sometimes
went into the same failing node again to try a different outgoing
connection that wasn't yet known to mission control and therefore not
penalized before.
This commit is contained in:
Joost Jager
2020-01-21 09:02:25 +01:00
parent ad0a89b844
commit ef28d2aaed
4 changed files with 26 additions and 15 deletions

View File

@ -424,11 +424,13 @@ func (i *interpretedResult) failNode(rt *route.Route, idx int) {
// Mark the incoming connection as failed for the node. We intent to
// penalize as much as we can for a node level failure, including future
// outgoing traffic for this connection. The pair as it is returned by
// getPair is directed towards the failed node. Therefore we first
// reverse the pair. We don't want to affect the score of the node
// sending towards the failing node.
// getPair is penalized in the original and the reversed direction. Note
// that this will also affect the score of the failing node's peers.
// This is necessary to prevent future routes from keep going into the
// same node again.
incomingChannelIdx := idx - 1
inPair, _ := getPair(rt, incomingChannelIdx)
i.pairResults[inPair] = failPairResult(0)
i.pairResults[inPair.Reverse()] = failPairResult(0)
// If not the ultimate node, mark the outgoing connection as failed for
@ -437,6 +439,7 @@ func (i *interpretedResult) failNode(rt *route.Route, idx int) {
outgoingChannelIdx := idx
outPair, _ := getPair(rt, outgoingChannelIdx)
i.pairResults[outPair] = failPairResult(0)
i.pairResults[outPair.Reverse()] = failPairResult(0)
}
}