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

@@ -950,11 +950,13 @@ func (r *ChannelRouter) FindRoutes(target *btcec.PublicKey,
// aren't able to support the total satoshis flow once fees have been
// factored in.
validRoutes := make([]*Route, 0, len(shortestPaths))
sourceVertex := newVertex(r.selfNode.PubKey)
for _, path := range shortestPaths {
// Attempt to make the path into a route. We snip off the first
// hop in the path as it contains a "self-hop" that is inserted
// by our KSP algorithm.
route, err := newRoute(amt, path[1:], uint32(currentHeight))
route, err := newRoute(amt, sourceVertex, path[1:],
uint32(currentHeight))
if err != nil {
continue
}