Skip to content

Commit

Permalink
eth/downloader: don't touch internal state on beacon Head retrieval
Browse files Browse the repository at this point in the history
  • Loading branch information
karalabe committed Jan 11, 2022
1 parent 1e4f299 commit 1603260
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions eth/downloader/skeleton.go
Expand Up @@ -944,14 +944,14 @@ func (s *skeleton) Head() (*types.Header, error) {
if len(status) == 0 {
return nil, errors.New("beacon sync not yet started")
}
s.progress = new(skeletonProgress)
if err := json.Unmarshal(status, s.progress); err != nil {
progress := new(skeletonProgress)
if err := json.Unmarshal(status, progress); err != nil {
return nil, err
}
if s.progress.Subchains[0].Tail != 1 {
if progress.Subchains[0].Tail != 1 {
return nil, errors.New("beacon sync not yet finished")
}
return rawdb.ReadSkeletonHeader(s.db, s.progress.Subchains[0].Head), nil
return rawdb.ReadSkeletonHeader(s.db, progress.Subchains[0].Head), nil
}

// Header retrieves a specific header tracked by the skeleton syncer. This method
Expand Down

0 comments on commit 1603260

Please sign in to comment.