routing: convert to node pair based

Previously mission control tracked failures on a per node, per channel basis.
This commit changes this to tracking on the level of directed node pairs. The goal
of moving to this coarser-grained level is to reduce the number of required
payment attempts without compromising payment reliability.
This commit is contained in:
Joost Jager
2019-07-29 15:10:58 +02:00
parent 6ee2c04190
commit f1769c8c8c
17 changed files with 1133 additions and 995 deletions

View File

@@ -77,7 +77,7 @@ var (
// noProbabilitySource is used in testing to return the same probability 1 for
// all edges.
func noProbabilitySource(route.Vertex, EdgeLocator, lnwire.MilliSatoshi) float64 {
func noProbabilitySource(route.Vertex, route.Vertex, lnwire.MilliSatoshi) float64 {
return 1
}
@@ -2156,6 +2156,8 @@ func testProbabilityRouting(t *testing.T, p10, p11, p20, minProbability float64,
}
defer testGraphInstance.cleanUp()
alias := testGraphInstance.aliasMap
sourceNode, err := testGraphInstance.graph.SourceNode()
if err != nil {
t.Fatalf("unable to fetch source node: %v", err)
@@ -2166,19 +2168,19 @@ func testProbabilityRouting(t *testing.T, p10, p11, p20, minProbability float64,
target := testGraphInstance.aliasMap["target"]
// Configure a probability source with the test parameters.
probabilitySource := func(node route.Vertex, edge EdgeLocator,
probabilitySource := func(fromNode, toNode route.Vertex,
amt lnwire.MilliSatoshi) float64 {
if amt == 0 {
t.Fatal("expected non-zero amount")
}
switch edge.ChannelID {
case 10:
switch {
case fromNode == alias["a1"] && toNode == alias["a2"]:
return p10
case 11:
case fromNode == alias["a2"] && toNode == alias["target"]:
return p11
case 20:
case fromNode == alias["b"] && toNode == alias["target"]:
return p20
default:
return 1