From 3c2c30778c3cab393eee10909c0d7efba0421f30 Mon Sep 17 00:00:00 2001 From: Techno Freak Date: Wed, 26 Jul 2023 14:05:57 +0300 Subject: [PATCH] fix: discard saving block when validators query fails --- pkg/app_manager.go | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/pkg/app_manager.go b/pkg/app_manager.go index fb392b8..f258c14 100644 --- a/pkg/app_manager.go +++ b/pkg/app_manager.go @@ -338,19 +338,20 @@ func (a *AppManager) PopulateLatestBlock() { return } + a.Logger.Info(). + Int64("height", block.Height). + Msg("Last block height") + validators, err := a.RPCManager.GetActiveSetAtBlock(block.Height) if err != nil { a.Logger.Error(). Err(err). Msg("Error updating historical validators") + return } block.SetValidators(validators) - a.Logger.Info(). - Int64("height", block.Height). - Msg("Last block height") - if err := a.StateManager.AddBlock(block); err != nil { a.Logger.Error(). Err(err).