Skip to content

Commit

Permalink
Clear initial sync state caches after round robin sync (#4817)
Browse files Browse the repository at this point in the history
* Clear initial sync state caches after round robin sync

* fix test mock

* lint

Co-authored-by: prylabs-bulldozer[bot] <58059840+prylabs-bulldozer[bot]@users.noreply.github.com>
  • Loading branch information
prestonvanloon and prylabs-bulldozer[bot] committed Feb 10, 2020
1 parent 1a5c515 commit 4598344
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 0 deletions.
3 changes: 3 additions & 0 deletions beacon-chain/blockchain/testing/mock.go
Expand Up @@ -231,3 +231,6 @@ func (ms *ChainService) Participation(epoch uint64) *precompute.Balance {
func (ms *ChainService) IsValidAttestation(ctx context.Context, att *ethpb.Attestation) bool {
return ms.ValidAttestation
}

// ClearCachedStates does nothing.
func (ms *ChainService) ClearCachedStates() {}
1 change: 1 addition & 0 deletions beacon-chain/sync/initial-sync/round_robin.go
Expand Up @@ -43,6 +43,7 @@ const refreshTime = 6 * time.Second
func (s *Service) roundRobinSync(genesis time.Time) error {
ctx, cancel := context.WithCancel(context.Background())
defer cancel()
defer s.chain.ClearCachedStates()

if cfg := featureconfig.Get(); cfg.EnableSkipSlotsCache {
cfg.EnableSkipSlotsCache = false
Expand Down
1 change: 1 addition & 0 deletions beacon-chain/sync/initial-sync/service.go
Expand Up @@ -25,6 +25,7 @@ var _ = shared.Service(&Service{})
type blockchainService interface {
blockchain.BlockReceiver
blockchain.HeadFetcher
ClearCachedStates()
}

const (
Expand Down

0 comments on commit 4598344

Please sign in to comment.