mirror of
https://gitlab.com/pulsechaincom/prysm-pulse.git
synced 2024-12-26 05:17:22 +00:00
ffa08f5a85
* stream aggreagted attestations from p2p network to indexed attestation stream * remove excessive log * fix test * handle nil attestation as well * Update beacon-chain/sync/subscriber_beacon_aggregate_proof.go * Update beacon-chain/sync/subscriber_beacon_aggregate_proof.go * Update beacon-chain/sync/subscriber_beacon_aggregate_proof_test.go * terence feedback * sort imports * sort imports * Change to received buffer * preston feedback * error log * raul feedback * more logging changes * fix duplicate package name Co-authored-by: terence tsao <terence@prysmaticlabs.com> Co-authored-by: prylabs-bulldozer[bot] <58059840+prylabs-bulldozer[bot]@users.noreply.github.com> Co-authored-by: Ivan Martinez <ivanthegreatdev@gmail.com>
35 lines
1.1 KiB
Go
35 lines
1.1 KiB
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"
|
|
mock "github.com/prysmaticlabs/prysm/beacon-chain/blockchain/testing"
|
|
"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,
|
|
attestationNotifier: (&mock.ChainService{}).OperationNotifier(),
|
|
}
|
|
|
|
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")
|
|
}
|
|
}
|