Skip to content

Commit

Permalink
a
Browse files Browse the repository at this point in the history
  • Loading branch information
Giulio2002 committed Apr 10, 2023
1 parent 2bb8317 commit de421b9
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion cmd/erigon-cl/forkchoice/fork_graph/fork_graph.go
Original file line number Diff line number Diff line change
Expand Up @@ -203,6 +203,12 @@ func (f *ForkGraph) GetState(blockRoot libcommon.Hash) (*state.BeaconState, erro
log.Debug("Could not retrieve state: Missing changeset", "missing", currentIteratorRoot)
return nil, nil
}
// you need the parent for the root
parent, isSegmentPresent := f.GetHeader(edge)
if !isSegmentPresent {
log.Debug("Could not retrieve state: Missing header", "missing", currentIteratorRoot)
return nil, nil
}
// Recompute currentBlockRoot
currentBlockRoot, err := f.lastState.BlockRoot()
if err != nil {
Expand All @@ -211,7 +217,7 @@ func (f *ForkGraph) GetState(blockRoot libcommon.Hash) (*state.BeaconState, erro
inverselyTraversedRoots = append(inverselyTraversedRoots, currentBlockRoot)
inverseChangesets = append(inverseChangesets, changeset)
// go on.
edge = currentBlockRoot
edge = parent.ParentRoot
}
// Reverse changeset ONLY if we can
for i := len(inverseChangesets) - 1; i >= 0; i-- {
Expand Down

0 comments on commit de421b9

Please sign in to comment.