Skip to content

Commit fb67c47

Browse files
committed
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.
1 parent 9251126 commit fb67c47

File tree

2 files changed

+22
-0
lines changed

2 files changed

+22
-0
lines changed

routing/route/route.go

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -773,3 +773,19 @@ func (r *Route) String() string {
773773
b.String(), r.TotalTimeLock,
774774
)
775775
}
776+
777+
// ChanIDString returns the route's channel IDs as a formatted string.
778+
func ChanIDString(r *Route) string {
779+
var b strings.Builder
780+
781+
for i, hop := range r.Hops {
782+
b.WriteString(fmt.Sprintf("%v",
783+
strconv.FormatUint(hop.ChannelID, 10),
784+
))
785+
if i != len(r.Hops)-1 {
786+
b.WriteString(" -> ")
787+
}
788+
}
789+
790+
return b.String()
791+
}

routing/router.go

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -694,6 +694,12 @@ func (r *ChannelRouter) FindBlindedPaths(destination route.Vertex,
694694
// Don't bother adding a route if its success probability less
695695
// minimum that can be assigned to any single pair.
696696
if totalRouteProbability <= DefaultMinRouteProbability {
697+
log.Debugf("Not using route (%v) as a blinded "+
698+
"path since it resulted in an low "+
699+
"probability path(%.3f)",
700+
route.ChanIDString(routeWithProbability.route),
701+
routeWithProbability.probability,
702+
)
697703
continue
698704
}
699705

0 commit comments

Comments
 (0)