From 56a5aa5b1d79ba9130340c490155528a8b30135c Mon Sep 17 00:00:00 2001 From: jholdstock Date: Fri, 9 Oct 2020 08:43:25 +0100 Subject: [PATCH] background: Exit early if no votable tickets --- background/background.go | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/background/background.go b/background/background.go index 2c55a0c..c1f36a3 100644 --- a/background/background.go +++ b/background/background.go @@ -245,6 +245,11 @@ func blockConnected() { continue } + // If the database has no votable tickets, there is nothing more to do + if len(dbTickets) == 0 { + break + } + // Find the oldest block height from confirmed tickets. oldestHeight := findOldestHeight(dbTickets) @@ -416,6 +421,11 @@ func checkWalletConsistency() { return } + // If the database has no votable tickets, there is nothing more to do + if len(votableTickets) == 0 { + return + } + // Find the oldest block height from confirmed tickets. oldestHeight := findOldestHeight(votableTickets)