mirror of
https://gitlab.com/pulsechaincom/prysm-pulse.git
synced 2025-01-08 10:41:19 +00:00
27 lines
741 B
Go
27 lines
741 B
Go
|
package sync
|
||
|
|
||
|
import (
|
||
|
"context"
|
||
|
"fmt"
|
||
|
|
||
|
"github.com/gogo/protobuf/proto"
|
||
|
eth "github.com/prysmaticlabs/ethereumapis/eth/v1alpha1"
|
||
|
"github.com/prysmaticlabs/prysm/beacon-chain/core/helpers"
|
||
|
)
|
||
|
|
||
|
func (r *Service) committeeIndexBeaconAttestationSubscriber(ctx context.Context, msg proto.Message) error {
|
||
|
a, ok := msg.(*eth.Attestation)
|
||
|
if !ok {
|
||
|
return fmt.Errorf("message was not type *eth.Attestation, type=%T", msg)
|
||
|
}
|
||
|
return r.attPool.SaveUnaggregatedAttestation(a)
|
||
|
}
|
||
|
|
||
|
func (r *Service) currentCommitteeIndex() int {
|
||
|
activeValidatorIndices, err := r.chain.HeadValidatorsIndices(helpers.SlotToEpoch(r.chain.HeadSlot()))
|
||
|
if err != nil {
|
||
|
panic(err)
|
||
|
}
|
||
|
return int(helpers.SlotCommitteeCount(uint64(len(activeValidatorIndices))))
|
||
|
}
|