mirror of
https://gitlab.com/pulsechaincom/prysm-pulse.git
synced 2024-12-22 03:30:35 +00:00
Pool returns empty contribution slice instead of nil (#9808)
This commit is contained in:
parent
290b4273dd
commit
d7cad27cc3
@ -74,7 +74,7 @@ func (s *Store) SyncCommitteeContributions(slot types.Slot) ([]*ethpb.SyncCommit
|
||||
|
||||
item := s.contributionCache.RetrieveByKey(syncCommitteeKey(slot))
|
||||
if item == nil {
|
||||
return nil, nil
|
||||
return []*ethpb.SyncCommitteeContribution{}, nil
|
||||
}
|
||||
|
||||
contributions, ok := item.Value.([]*ethpb.SyncCommitteeContribution)
|
||||
|
@ -36,11 +36,11 @@ func TestSyncCommitteeContributionCache_RoundTrip(t *testing.T) {
|
||||
|
||||
conts, err := store.SyncCommitteeContributions(1)
|
||||
require.NoError(t, err)
|
||||
require.DeepSSZEqual(t, []*ethpb.SyncCommitteeContribution(nil), conts)
|
||||
require.DeepSSZEqual(t, []*ethpb.SyncCommitteeContribution{}, conts)
|
||||
|
||||
conts, err = store.SyncCommitteeContributions(2)
|
||||
require.NoError(t, err)
|
||||
require.DeepSSZEqual(t, []*ethpb.SyncCommitteeContribution(nil), conts)
|
||||
require.DeepSSZEqual(t, []*ethpb.SyncCommitteeContribution{}, conts)
|
||||
|
||||
conts, err = store.SyncCommitteeContributions(3)
|
||||
require.NoError(t, err)
|
||||
@ -73,10 +73,10 @@ func TestSyncCommitteeContributionCache_RoundTrip(t *testing.T) {
|
||||
// All the contributions should persist after get.
|
||||
conts, err = store.SyncCommitteeContributions(1)
|
||||
require.NoError(t, err)
|
||||
require.DeepSSZEqual(t, []*ethpb.SyncCommitteeContribution(nil), conts)
|
||||
require.DeepSSZEqual(t, []*ethpb.SyncCommitteeContribution{}, conts)
|
||||
conts, err = store.SyncCommitteeContributions(2)
|
||||
require.NoError(t, err)
|
||||
require.DeepSSZEqual(t, []*ethpb.SyncCommitteeContribution(nil), conts)
|
||||
require.DeepSSZEqual(t, []*ethpb.SyncCommitteeContribution{}, conts)
|
||||
|
||||
conts, err = store.SyncCommitteeContributions(3)
|
||||
require.NoError(t, err)
|
||||
|
Loading…
Reference in New Issue
Block a user