mirror of
https://gitlab.com/pulsechaincom/prysm-pulse.git
synced 2024-12-25 12:57:18 +00:00
Ignore empty public keys in gRPC request (#1309)
* Ignore empty public keys in gRPC request * Remove log
This commit is contained in:
parent
5b14c8695d
commit
ddf454a04d
@ -447,6 +447,9 @@ func assignmentsForPublicKeys(keys []*pb.PublicKey, beaconState *pbp2p.BeaconSta
|
||||
assignments := []*pb.Assignment{}
|
||||
|
||||
for _, val := range keys {
|
||||
if len(val.PublicKey) == 0 {
|
||||
continue
|
||||
}
|
||||
// For the corresponding public key and current crystallized state,
|
||||
// we determine the assigned slot for the validator and whether it
|
||||
// should act as a proposer or attester.
|
||||
|
@ -656,3 +656,16 @@ func TestValidatorAssignments(t *testing.T) {
|
||||
exitRoutine <- true
|
||||
testutil.AssertLogsContain(t, hook, "Sending new cycle assignments to validator clients")
|
||||
}
|
||||
|
||||
func TestAssignmentsForPublicKeys_emptyPubKey(t *testing.T) {
|
||||
pks := []*pb.PublicKey{&pb.PublicKey{}}
|
||||
|
||||
a, err := assignmentsForPublicKeys(pks, nil)
|
||||
if err != nil {
|
||||
t.Error(err)
|
||||
}
|
||||
|
||||
if len(a) > 0 {
|
||||
t.Errorf("Expected no assignments, but got %v", a)
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user