mirror of
https://gitlab.com/pulsechaincom/prysm-pulse.git
synced 2024-12-24 20:37:17 +00:00
Declare err in loop to limit its scope (#8200)
Co-authored-by: prylabs-bulldozer[bot] <58059840+prylabs-bulldozer[bot]@users.noreply.github.com>
This commit is contained in:
parent
1abe92fd8b
commit
9d737d60f4
@ -77,7 +77,7 @@ func (s *Service) SubscribeToTopic(topic string, opts ...pubsub.SubOpt) (*pubsub
|
||||
if featureconfig.Get().EnablePeerScorer {
|
||||
scoringParams := topicScoreParams(topic)
|
||||
if scoringParams != nil {
|
||||
if err = topicHandle.SetScoreParams(scoringParams); err != nil {
|
||||
if err := topicHandle.SetScoreParams(scoringParams); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
}
|
||||
|
@ -78,7 +78,7 @@ func privKey(cfg *Config) (*ecdsa.PrivateKey, error) {
|
||||
}
|
||||
dst := make([]byte, hex.EncodedLen(len(rawbytes)))
|
||||
hex.Encode(dst, rawbytes)
|
||||
if err = fileutil.WriteFile(defaultKeyPath, dst); err != nil {
|
||||
if err := fileutil.WriteFile(defaultKeyPath, dst); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
convertedKey := convertFromInterfacePrivKey(priv)
|
||||
@ -129,7 +129,7 @@ func metaDataFromConfig(cfg *Config) (*pbp2p.MetaData, error) {
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
if err = fileutil.WriteFile(defaultKeyPath, dst); err != nil {
|
||||
if err := fileutil.WriteFile(defaultKeyPath, dst); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return metaData, nil
|
||||
|
@ -312,7 +312,7 @@ func TestRPCBeaconBlocksByRange_RPCHandlerRateLimitOverflow(t *testing.T) {
|
||||
})
|
||||
stream, err := p1.BHost.NewStream(context.Background(), p2.BHost.ID(), pcl)
|
||||
require.NoError(t, err)
|
||||
if err = r.beaconBlocksByRangeRPCHandler(context.Background(), req, stream); err != nil {
|
||||
if err := r.beaconBlocksByRangeRPCHandler(context.Background(), req, stream); err != nil {
|
||||
return err
|
||||
}
|
||||
if testutil.WaitTimeout(&wg, 1*time.Second) {
|
||||
@ -563,7 +563,7 @@ func TestRPCBeaconBlocksByRange_EnforceResponseInvariants(t *testing.T) {
|
||||
})
|
||||
stream, err := p1.BHost.NewStream(context.Background(), p2.BHost.ID(), pcl)
|
||||
require.NoError(t, err)
|
||||
if err = r.beaconBlocksByRangeRPCHandler(context.Background(), req, stream); err != nil {
|
||||
if err := r.beaconBlocksByRangeRPCHandler(context.Background(), req, stream); err != nil {
|
||||
return err
|
||||
}
|
||||
if testutil.WaitTimeout(&wg, 1*time.Second) {
|
||||
@ -725,7 +725,7 @@ func TestRPCBeaconBlocksByRange_FilterBlocks(t *testing.T) {
|
||||
})
|
||||
stream, err := p1.BHost.NewStream(context.Background(), p2.BHost.ID(), pcl)
|
||||
require.NoError(t, err)
|
||||
if err = r.beaconBlocksByRangeRPCHandler(context.Background(), req, stream); err != nil {
|
||||
if err := r.beaconBlocksByRangeRPCHandler(context.Background(), req, stream); err != nil {
|
||||
return err
|
||||
}
|
||||
if testutil.WaitTimeout(&wg, 1*time.Second) {
|
||||
|
@ -72,7 +72,7 @@ func (ds *Service) DetectAttesterSlashings(
|
||||
}
|
||||
}
|
||||
if len(slashings) > 0 {
|
||||
if err = ds.slasherDB.SaveAttesterSlashings(ctx, status.Active, slashings); err != nil {
|
||||
if err := ds.slasherDB.SaveAttesterSlashings(ctx, status.Active, slashings); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user