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 2021-01-20 09:52:31 +01:00
parent a0f3624303
commit 1231c90a19
No known key found for this signature in database
GPG Key ID: 15BAADA29DA20D26

@ -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.