routing: also include the source node in the nextHopMap index

In this commit we modify the newRoute function to also add the source
node to the nextHopMap index. With this addition the indexes will now
allow the router to react based on failures that occur during the
_first_ hop, meaning the channel directly attached to the source node.
This commit is contained in:
Olaoluwa Osuntokun committed 2017-10-10 22:19:23 -07:00
1 parent 70e114fa6f
commit f6ac31281b
3 files changed
+12 -5

No files matched your search

+3 -2
View File
@@ -303,6 +303,7 @@ func TestBasicGraphPathFinding(t *testing.T) {
if err != nil {
t.Fatalf("unable to fetch source node: %v", err)
}
sourceVertex := newVertex(sourceNode.PubKey)
ignoredEdges := make(map[uint64]struct{})
ignoredVertexes := make(map[vertex]struct{})
@@ -320,7 +321,7 @@ func TestBasicGraphPathFinding(t *testing.T) {
if err != nil {
t.Fatalf("unable to find path: %v", err)
}
route, err := newRoute(paymentAmt, path, startingHeight)
route, err := newRoute(paymentAmt, sourceVertex, path, startingHeight)
if err != nil {
t.Fatalf("unable to create path: %v", err)
}
@@ -416,7 +417,7 @@ func TestBasicGraphPathFinding(t *testing.T) {
if err != nil {
t.Fatalf("unable to find route: %v", err)
}
route, err = newRoute(paymentAmt, path, startingHeight)
route, err = newRoute(paymentAmt, sourceVertex, path, startingHeight)
if err != nil {
t.Fatalf("unable to create path: %v", err)
}