Skip to content

Commit

Permalink
fix: discard saving block when validators query fails
Browse files Browse the repository at this point in the history
  • Loading branch information
freak12techno committed Jul 26, 2023
1 parent e6e2017 commit 3c2c307
Showing 1 changed file with 5 additions and 4 deletions.
9 changes: 5 additions & 4 deletions pkg/app_manager.go
Original file line number Diff line number Diff line change
Expand Up @@ -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).
Expand Down

0 comments on commit 3c2c307

Please sign in to comment.