mirror of
https://github.com/OffchainLabs/prysm.git
synced 2026-01-09 13:28:01 -05:00
Better Nil Check in Slasher (#5053)
* rem slasher proto * Merge branch 'master' of github.com:prysmaticlabs/prysm * Merge branch 'master' of github.com:prysmaticlabs/prysm * Merge branch 'master' of github.com:prysmaticlabs/prysm * Merge branch 'master' of github.com:prysmaticlabs/prysm * Merge branch 'master' of github.com:prysmaticlabs/prysm * Merge branch 'master' of github.com:prysmaticlabs/prysm * Merge branch 'master' of github.com:prysmaticlabs/prysm * Merge branch 'master' of github.com:prysmaticlabs/prysm * some nil checks in slasher
This commit is contained in:
@@ -26,7 +26,7 @@ func (ds *Service) detectAttesterSlashings(
|
||||
return nil, nil
|
||||
}
|
||||
|
||||
var slashings []*ethpb.AttesterSlashing
|
||||
var slashings []*ethpb.AttesterSlashing
|
||||
for _, result := range results {
|
||||
var slashing *ethpb.AttesterSlashing
|
||||
switch result.Kind {
|
||||
@@ -41,7 +41,9 @@ func (ds *Service) detectAttesterSlashings(
|
||||
return nil, errors.Wrap(err, "could not detect surround votes on attestation")
|
||||
}
|
||||
}
|
||||
slashings = append(slashings, slashing)
|
||||
if slashing != nil {
|
||||
slashings = append(slashings, slashing)
|
||||
}
|
||||
}
|
||||
|
||||
return slashings, nil
|
||||
|
||||
@@ -152,7 +152,7 @@ func (ds *Service) submitAttesterSlashings(ctx context.Context, slashings []*eth
|
||||
}
|
||||
for i := 0; i < len(slashings); i++ {
|
||||
slash := slashings[i]
|
||||
if slash.Attestation_1 != nil && slash.Attestation_2 != nil {
|
||||
if slash != nil && slash.Attestation_1 != nil && slash.Attestation_2 != nil {
|
||||
slashableIndices := sliceutil.IntersectionUint64(slashings[i].Attestation_1.AttestingIndices, slashings[i].Attestation_2.AttestingIndices)
|
||||
slashedIndices = append(slashedIndices, slashableIndices...)
|
||||
ds.attesterSlashingsFeed.Send(slashings[i])
|
||||
|
||||
Reference in New Issue
Block a user