graph/db: fix log line in KVStore
Ensure that the log line in `ChanUpdatesInHorizon` cannot cause a divide-by-zero panic.
This commit is contained in:
1 file changed
+8
-3
@@ -2149,9 +2149,14 @@ func (c *KVStore) ChanUpdatesInHorizon(startTime,
|
|||||||
c.chanCache.insert(chanid, channel)
|
c.chanCache.insert(chanid, channel)
|
||||||
}
|
}
|
||||||
|
|
||||||
log.Debugf("ChanUpdatesInHorizon hit percentage: %f (%d/%d)",
|
if len(edgesInHorizon) > 0 {
|
||||||
float64(hits)/float64(len(edgesInHorizon)), hits,
|
log.Debugf("ChanUpdatesInHorizon hit percentage: %f (%d/%d)",
|
||||||
len(edgesInHorizon))
|
float64(hits)/float64(len(edgesInHorizon)), hits,
|
||||||
|
len(edgesInHorizon))
|
||||||
|
} else {
|
||||||
|
log.Debugf("ChanUpdatesInHorizon returned no edges in "+
|
||||||
|
"horizon (%s, %s)", startTime, endTime)
|
||||||
|
}
|
||||||
|
|
||||||
return edgesInHorizon, nil
|
return edgesInHorizon, nil
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in new issue
Block a user