From 5b23ffb97af199c357b19bde7ec68c472980f727 Mon Sep 17 00:00:00 2001 From: MatheusFranco99 <48058141+MatheusFranco99@users.noreply.github.com> Date: Tue, 2 Jul 2024 11:15:28 +0100 Subject: [PATCH 1/2] Use GetShare to avoid duplicated code --- ssv/validator_registration.go | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-) diff --git a/ssv/validator_registration.go b/ssv/validator_registration.go index c4ea56df6..ebbe7fe31 100644 --- a/ssv/validator_registration.go +++ b/ssv/validator_registration.go @@ -168,14 +168,10 @@ func (r *ValidatorRegistrationRunner) executeDuty(duty types.Duty) error { func (r *ValidatorRegistrationRunner) calculateValidatorRegistration(duty types.Duty) (*v1.ValidatorRegistration, error) { - if len(r.BaseRunner.Share) == 0 { + share := r.GetShare() + if share == nil { return nil, errors.New("no share to get validator public key") } - var share *types.Share - for _, shareInstance := range r.BaseRunner.Share { - share = shareInstance - break - } pk := phase0.BLSPubKey{} copy(pk[:], share.ValidatorPubKey[:]) From 6e0400c054affdf65a4227f39dc954e5f5ffe137 Mon Sep 17 00:00:00 2001 From: MatheusFranco99 <48058141+MatheusFranco99@users.noreply.github.com> Date: Tue, 2 Jul 2024 11:18:20 +0100 Subject: [PATCH 2/2] Use GetShare to avoid duplicated code --- ssv/validator_registration.go | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-) diff --git a/ssv/validator_registration.go b/ssv/validator_registration.go index ebbe7fe31..250e6c3a4 100644 --- a/ssv/validator_registration.go +++ b/ssv/validator_registration.go @@ -76,14 +76,10 @@ func (r *ValidatorRegistrationRunner) ProcessPreConsensus(signedMsg *types.Parti copy(specSig[:], fullSig) // Get share - if len(r.BaseRunner.Share) == 0 { + share := r.GetShare() + if share == nil { return errors.New("no share to get validator public key") } - var share *types.Share - for _, shareInstance := range r.BaseRunner.Share { - share = shareInstance - break - } if err := r.beacon.SubmitValidatorRegistration(share.ValidatorPubKey[:], share.FeeRecipientAddress, specSig); err != nil {