mirror of
https://gitlab.com/pulsechaincom/prysm-pulse.git
synced 2024-12-29 06:37:17 +00:00
fdad7e67b0
* hasSeenAggregatorIndexSlot -> hasSeenAggregatorIndexEpoch * Fix test * Update subscriber * setSeenCommitteeIndicesSlot -> setSeenCommitteeIndicesEpoch * Fix test * Revert "setSeenCommitteeIndicesSlot -> setSeenCommitteeIndicesEpoch" This reverts commit bd638ae55675d711f67f98afc8a348803e72cd3a. * Fixed unaggregated att seen cache to use per slot
33 lines
994 B
Go
33 lines
994 B
Go
package sync
|
|
|
|
import (
|
|
"context"
|
|
"reflect"
|
|
"testing"
|
|
|
|
lru "github.com/hashicorp/golang-lru"
|
|
ethpb "github.com/prysmaticlabs/ethereumapis/eth/v1alpha1"
|
|
"github.com/prysmaticlabs/go-bitfield"
|
|
"github.com/prysmaticlabs/prysm/beacon-chain/operations/attestations"
|
|
)
|
|
|
|
func TestBeaconAggregateProofSubscriber_CanSave(t *testing.T) {
|
|
c, err := lru.New(10)
|
|
if err != nil {
|
|
t.Fatal(err)
|
|
}
|
|
r := &Service{
|
|
attPool: attestations.NewPool(),
|
|
seenAttestationCache: c,
|
|
}
|
|
|
|
a := ðpb.SignedAggregateAttestationAndProof{Message: ðpb.AggregateAttestationAndProof{Aggregate: ðpb.Attestation{Data: ðpb.AttestationData{Target: ðpb.Checkpoint{}}, AggregationBits: bitfield.Bitlist{0x07}}, AggregatorIndex: 100}}
|
|
if err := r.beaconAggregateProofSubscriber(context.Background(), a); err != nil {
|
|
t.Fatal(err)
|
|
}
|
|
|
|
if !reflect.DeepEqual(r.attPool.AggregatedAttestations(), []*ethpb.Attestation{a.Message.Aggregate}) {
|
|
t.Error("Did not save aggregated attestation")
|
|
}
|
|
}
|