Skip to content

Commit

Permalink
Use strings builder for attester lock key (#8349)
Browse files Browse the repository at this point in the history
* Use strings builder

* Handle error
  • Loading branch information
terencechain committed Jan 27, 2021
1 parent 0753636 commit 2bf03d5
Showing 1 changed file with 12 additions and 1 deletion.
13 changes: 12 additions & 1 deletion validator/client/attest.go
Expand Up @@ -5,6 +5,7 @@ import (
"context"
"errors"
"fmt"
"strings"
"time"

ethpb "github.com/prysmaticlabs/ethereumapis/eth/v1alpha1"
Expand Down Expand Up @@ -34,7 +35,17 @@ func (v *validator) SubmitAttestation(ctx context.Context, slot uint64, pubKey [

v.waitOneThirdOrValidBlock(ctx, slot)

lock := mputil.NewMultilock(string(roleAttester), string(pubKey[:]))
var b strings.Builder
if err := b.WriteByte(byte(roleAttester)); err != nil {
log.WithError(err).Error("Could not write role byte for lock key")
return
}
_, err := b.Write(pubKey[:])
if err != nil {
log.WithError(err).Error("Could not write pubkey bytes for lock key")
return
}
lock := mputil.NewMultilock(b.String())
lock.Lock()
defer lock.Unlock()

Expand Down

0 comments on commit 2bf03d5

Please sign in to comment.