Skip to content

Commit

Permalink
update bold
Browse files Browse the repository at this point in the history
  • Loading branch information
rauljordan committed Oct 23, 2023
1 parent f47efd8 commit 2211540
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 6 deletions.
7 changes: 2 additions & 5 deletions staker/state_provider.go
Original file line number Diff line number Diff line change
Expand Up @@ -339,7 +339,7 @@ func (s *StateManager) CollectMachineHashes(
MessageHeight: protocol.Height(messageNum),
StepHeights: cfg.StepHeights,
}
if s.historyCache != nil && !cfg.DisableCache {
if s.historyCache != nil {
cachedRoots, err := s.historyCache.Get(cacheKey, cfg.NumDesiredHashes)
switch {
case err == nil:
Expand All @@ -365,16 +365,13 @@ func (s *StateManager) CollectMachineHashes(
return nil, err
}
expectedEnding := &expectedEndingGlobalState
if cfg.DisableFinalStateModify {
expectedEnding = nil
}
stepLeaves := execRun.GetLeavesWithStepSize(uint64(cfg.MachineStartIndex), uint64(cfg.StepSize), cfg.NumDesiredHashes, expectedEnding)
result, err := stepLeaves.Await(ctx)
if err != nil {
return nil, err
}
// Do not save a history commitment of length 1 to the cache.
if len(result) > 1 && s.historyCache != nil && !cfg.DisableCache {
if len(result) > 1 && s.historyCache != nil {
if err := s.historyCache.Put(cacheKey, result); err != nil {
if !errors.Is(err, challengecache.ErrFileAlreadyExists) {
return nil, err
Expand Down

0 comments on commit 2211540

Please sign in to comment.