mirror of
https://github.com/lightningnetwork/lnd.git
synced 2025-08-27 14:11:04 +02:00
routing: Fix possible infinite loop on first hop misleading hint
Add ignore condition to additional edges that connect to self. These edges are already known and avoiding these hints protect the payment from malformed channel ids which could lead to infinite loop. Fixes lightningnetwork#6169. Co-authored-by: lsunsi <lsunsi@pm.me>
This commit is contained in:
@@ -538,10 +538,18 @@ func findPath(g *graphParams, r *RestrictParams, cfg *PathFindingConfig,
|
||||
|
||||
additionalEdgesWithSrc := make(map[route.Vertex][]*edgePolicyWithSource)
|
||||
for vertex, outgoingEdgePolicies := range g.additionalEdges {
|
||||
// Edges connected to self are always included in the graph,
|
||||
// therefore can be skipped. This prevents us from trying
|
||||
// routes to malformed hop hints.
|
||||
if vertex == self {
|
||||
continue
|
||||
}
|
||||
|
||||
// Build reverse lookup to find incoming edges. Needed because
|
||||
// search is taken place from target to source.
|
||||
for _, outgoingEdgePolicy := range outgoingEdgePolicies {
|
||||
toVertex := outgoingEdgePolicy.ToNodePubKey()
|
||||
|
||||
incomingEdgePolicy := &edgePolicyWithSource{
|
||||
sourceNode: vertex,
|
||||
edge: outgoingEdgePolicy,
|
||||
|
Reference in New Issue
Block a user