Skip to content

Commit

Permalink
Log a warning if attempting to save a nil state (prysmaticlabs#4779)
Browse files Browse the repository at this point in the history
* Log a warning if attempting to save a nil state
* Log a warning if attempting to save a nil state
  • Loading branch information
prestonvanloon authored and cryptomental committed Feb 28, 2020
1 parent 46bf360 commit 0136444
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions beacon-chain/blockchain/process_block_helpers.go
Expand Up @@ -275,6 +275,11 @@ func (s *Service) saveInitState(ctx context.Context, state *stateTrie.BeaconStat
cpt := state.FinalizedCheckpoint()
finalizedRoot := bytesutil.ToBytes32(cpt.Root)
fs := s.initSyncState[finalizedRoot]
if fs == nil {
// This might happen if the client was in sync and is now re-syncing for whatever reason.
log.Warn("Initial sync cache did not have finalized state root cached")
return nil
}

if err := s.beaconDB.SaveState(ctx, fs, finalizedRoot); err != nil {
return errors.Wrap(err, "could not save state")
Expand Down

0 comments on commit 0136444

Please sign in to comment.