mirror of
https://github.com/lightningnetwork/lnd.git
synced 2025-10-11 13:03:21 +02:00
routing: add logging for routes discarded due to low success probability
Create the ChanIDString function to return a string representation of the route's channel IDs, formatting them in the order they appear in the route (e.g., "chanID1 -> chanID2"). Discarded routes with a success probability lower than the minimum threshold are now logged accordingly when finding a blinded path.
This commit is contained in:
@@ -773,3 +773,19 @@ func (r *Route) String() string {
|
|||||||
b.String(), r.TotalTimeLock,
|
b.String(), r.TotalTimeLock,
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// ChanIDString returns the route's channel IDs as a formatted string.
|
||||||
|
func ChanIDString(r *Route) string {
|
||||||
|
var b strings.Builder
|
||||||
|
|
||||||
|
for i, hop := range r.Hops {
|
||||||
|
b.WriteString(fmt.Sprintf("%v",
|
||||||
|
strconv.FormatUint(hop.ChannelID, 10),
|
||||||
|
))
|
||||||
|
if i != len(r.Hops)-1 {
|
||||||
|
b.WriteString(" -> ")
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return b.String()
|
||||||
|
}
|
||||||
|
@@ -684,19 +684,27 @@ func (r *ChannelRouter) FindBlindedPaths(destination route.Vertex,
|
|||||||
prevNode = path[j].vertex
|
prevNode = path[j].vertex
|
||||||
}
|
}
|
||||||
|
|
||||||
// Don't bother adding a route if its success probability less
|
routeWithProbability := &routeWithProbability{
|
||||||
// minimum that can be assigned to any single pair.
|
|
||||||
if totalRouteProbability <= DefaultMinRouteProbability {
|
|
||||||
continue
|
|
||||||
}
|
|
||||||
|
|
||||||
routes = append(routes, &routeWithProbability{
|
|
||||||
route: &route.Route{
|
route: &route.Route{
|
||||||
SourcePubKey: introNode,
|
SourcePubKey: introNode,
|
||||||
Hops: hops,
|
Hops: hops,
|
||||||
},
|
},
|
||||||
probability: totalRouteProbability,
|
probability: totalRouteProbability,
|
||||||
})
|
}
|
||||||
|
|
||||||
|
// Don't bother adding a route if its success probability less
|
||||||
|
// minimum that can be assigned to any single pair.
|
||||||
|
if totalRouteProbability <= DefaultMinRouteProbability {
|
||||||
|
log.Debugf("Not using route (%v) as a blinded "+
|
||||||
|
"path since it resulted in an low "+
|
||||||
|
"probability path(%.3f)",
|
||||||
|
route.ChanIDString(routeWithProbability.route),
|
||||||
|
routeWithProbability.probability,
|
||||||
|
)
|
||||||
|
continue
|
||||||
|
}
|
||||||
|
|
||||||
|
routes = append(routes, routeWithProbability)
|
||||||
}
|
}
|
||||||
|
|
||||||
// Sort the routes based on probability.
|
// Sort the routes based on probability.
|
||||||
|
Reference in New Issue
Block a user