Skip to content

Commit

Permalink
Revert "Check HeadState First (#4830)" (#4851)
Browse files Browse the repository at this point in the history
This reverts commit 601f93a.
  • Loading branch information
nisdas committed Feb 13, 2020
1 parent f06dfd6 commit b7adf55
Show file tree
Hide file tree
Showing 2 changed files with 0 additions and 26 deletions.
19 changes: 0 additions & 19 deletions beacon-chain/blockchain/process_attestation_helpers.go
@@ -1,7 +1,6 @@
package blockchain

import (
"bytes"
"context"
"fmt"

Expand Down Expand Up @@ -29,24 +28,6 @@ func (s *Service) getAttPreState(ctx context.Context, c *ethpb.Checkpoint) (*sta
return cachedState, nil
}

headRoot, err := s.HeadRoot(ctx)
if err != nil {
return nil, errors.Wrapf(err, "could not get head root")
}
if bytes.Equal(headRoot, c.Root) {
st, err := s.HeadState(ctx)
if err != nil {
return nil, errors.Wrapf(err, "could not get head state")
}
if err := s.checkpointState.AddCheckpointState(&cache.CheckpointState{
Checkpoint: c,
State: st.Copy(),
}); err != nil {
return nil, errors.Wrap(err, "could not saved checkpoint state to cache")
}
return st, nil
}

baseState, err := s.beaconDB.State(ctx, bytesutil.ToBytes32(c.Root))
if err != nil {
return nil, errors.Wrapf(err, "could not get pre state for slot %d", helpers.StartSlot(c.Epoch))
Expand Down
7 changes: 0 additions & 7 deletions beacon-chain/blockchain/process_block_helpers.go
Expand Up @@ -73,13 +73,6 @@ func (s *Service) verifyBlkPreState(ctx context.Context, b *ethpb.BeaconBlock) (
}
return preState.Copy(), nil
}
headRoot, err := s.HeadRoot(ctx)
if err != nil {
return nil, errors.Wrapf(err, "could not get head root")
}
if bytes.Equal(headRoot, b.ParentRoot) {
return s.HeadState(ctx)
}

preState, err := s.beaconDB.State(ctx, bytesutil.ToBytes32(b.ParentRoot))
if err != nil {
Expand Down

0 comments on commit b7adf55

Please sign in to comment.