mirror of
https://github.com/lightningnetwork/lnd.git
synced 2025-11-25 21:48:23 +01:00
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:
@@ -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
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user