routing: avoid open DB transaction if no zombies to prune

We add a simple length check to the channels to be pruned to avoid
opening the DB if there is nothing to be done.
This commit is contained in:
Johan T. Halseth committed 2021-03-30 11:04:13 +02:00
1 parent a0f3624303
commit 1231c90a19
1 file changed
+3
+3
View File
@@ -897,6 +897,9 @@ func (r *ChannelRouter) pruneZombieChans() error {
}
log.Infof("Pruning %v zombie channels", len(chansToPrune))
if len(chansToPrune) == 0 {
return nil
}
// With the set of zombie-like channels obtained, we'll do another pass
// to delete them from the channel graph.