Add lock to PeerStatusScorer.SetHeadSlot (#10558)

(cherry picked from commit e04e4795c81ea939cf8996c632c52598cd69d170)
This commit is contained in:
Radosław Kapka 2022-04-21 17:02:20 +02:00 committed by GitHub
parent c8a7f6f0bd
commit d371cd6e89
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -145,5 +145,7 @@ func (s *PeerStatusScorer) peerStatus(pid peer.ID) (*pb.Status, error) {
// SetHeadSlot updates known head slot.
func (s *PeerStatusScorer) SetHeadSlot(slot types.Slot) {
s.store.Lock()
defer s.store.Unlock()
s.ourHeadSlot = slot
}