Skip to content

Commit

Permalink
fix nil pointer dereference in handleShareRemoved function
Browse files Browse the repository at this point in the history
  • Loading branch information
olegshmuelov committed Aug 28, 2024
1 parent 55dae0a commit f54a9a4
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions registry/storage/validatorstore.go
Original file line number Diff line number Diff line change
Expand Up @@ -293,9 +293,11 @@ func (c *validatorStore) handleShareRemoved(pk spectypes.ValidatorPK) {
}

// Update byValidatorIndex
c.muValidatorIndex.Lock()
delete(c.byValidatorIndex, share.BeaconMetadata.Index)
c.muValidatorIndex.Unlock()
if share.BeaconMetadata != nil {
c.muValidatorIndex.Lock()
delete(c.byValidatorIndex, share.BeaconMetadata.Index)
c.muValidatorIndex.Unlock()
}

// Update byCommitteeID
committeeID := share.CommitteeID()
Expand Down

0 comments on commit f54a9a4

Please sign in to comment.