From 1231c90a19048fac1b4bd92a89e38f8c970053a6 Mon Sep 17 00:00:00 2001 From: "Johan T. Halseth" Date: Wed, 20 Jan 2021 09:52:31 +0100 Subject: [PATCH] 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. --- routing/router.go | 3 +++ 1 file changed, 3 insertions(+) diff --git a/routing/router.go b/routing/router.go index dc133b9b..f5ee52f1 100644 --- a/routing/router.go +++ b/routing/router.go @@ -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.