mirror of
https://github.com/OffchainLabs/prysm.git
synced 2026-01-09 13:28:01 -05:00
Fixed validator pubkey -> index getter (#3361)
This commit is contained in:
@@ -1,7 +1,6 @@
|
||||
package kv
|
||||
|
||||
import (
|
||||
"bytes"
|
||||
"context"
|
||||
"encoding/binary"
|
||||
"time"
|
||||
@@ -99,12 +98,8 @@ func (k *Store) ValidatorIndex(ctx context.Context, publicKey [48]byte) (uint64,
|
||||
if enc == nil {
|
||||
return nil
|
||||
}
|
||||
var err error
|
||||
buf := bytes.NewBuffer(enc)
|
||||
validatorIdx, err = binary.ReadUvarint(buf)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
validatorIdx = binary.LittleEndian.Uint64(enc)
|
||||
|
||||
ok = true
|
||||
return nil
|
||||
})
|
||||
|
||||
@@ -279,7 +279,7 @@ func (bs *BeaconChainServer) ListValidatorBalances(
|
||||
return nil, status.Errorf(codes.Internal, "could not retrieve validator index: %v", err)
|
||||
}
|
||||
if !ok {
|
||||
return nil, status.Errorf(codes.Internal, "could validator index for public key %#x not found", pubKey)
|
||||
return nil, status.Errorf(codes.Internal, "could not find validator index for public key %#x not found", pubKey)
|
||||
}
|
||||
}
|
||||
|
||||
@@ -400,7 +400,7 @@ func (bs *BeaconChainServer) ListValidatorAssignments(
|
||||
return nil, status.Errorf(codes.Internal, "could not retrieve validator index: %v", err)
|
||||
}
|
||||
if !ok {
|
||||
return nil, status.Errorf(codes.Internal, "could validator index for public key %#x not found", pubKey)
|
||||
return nil, status.Errorf(codes.Internal, "could not find validator index for public key %#x not found", pubKey)
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -95,7 +95,7 @@ func (vs *ValidatorServer) ValidatorIndex(ctx context.Context, req *pb.Validator
|
||||
return nil, status.Errorf(codes.Internal, "could not retrieve validator index: %v", err)
|
||||
}
|
||||
if !ok {
|
||||
return nil, status.Errorf(codes.Internal, "could validator index for public key %#x not found", req.PublicKey)
|
||||
return nil, status.Errorf(codes.Internal, "could not find validator index for public key %#x not found", req.PublicKey)
|
||||
}
|
||||
}
|
||||
return &pb.ValidatorIndexResponse{Index: uint64(index)}, nil
|
||||
@@ -125,7 +125,7 @@ func (vs *ValidatorServer) ValidatorPerformance(
|
||||
return nil, status.Errorf(codes.Internal, "could not retrieve validator index: %v", err)
|
||||
}
|
||||
if !ok {
|
||||
return nil, status.Errorf(codes.Internal, "could validator index for public key %#x not found", req.PublicKey)
|
||||
return nil, status.Errorf(codes.Internal, "could not find validator index for public key %#x not found", req.PublicKey)
|
||||
}
|
||||
headState = vs.chainService.(blockchain.HeadRetriever).HeadState()
|
||||
|
||||
@@ -238,7 +238,7 @@ func (vs *ValidatorServer) assignment(
|
||||
return nil, status.Errorf(codes.Internal, "could not retrieve validator index: %v", err)
|
||||
}
|
||||
if !ok {
|
||||
return nil, status.Errorf(codes.Internal, "could validator index for public key %#x not found", pubkey)
|
||||
return nil, status.Errorf(codes.Internal, "could not find validator index for public key %#x not found", pubkey)
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user