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
2017-10-10 19:45:09 -07:00
parent 70e114fa6f
commit f6ac31281b
3 changed files with 12 additions and 5 deletions

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)
}