mirror of
https://gitlab.com/pulsechaincom/prysm-pulse.git
synced 2025-01-12 04:30:04 +00:00
d93ec64b21
* grpc connection * fix order * Merge branch 'fixInteropGenesis' of https://github.com/prysmaticlabs/prysm into grpc_client * gaz * grpc setup * running version * added comments * Merge branch 'master' of github.com:prysmaticlabs/prysm into grpc_client * fix test * terence feedback * terence feedback * feedback changes * feedback changes * comment fix * Merge branch 'master' of github.com:prysmaticlabs/prysm into grpc_client * logging when there is no chain head * rename function * terence and nishant feedback * fix imports * nishant feedback * fix wait for stop * fix imports * fix tests
40 lines
1004 B
Go
40 lines
1004 B
Go
package service
|
|
|
|
import (
|
|
"time"
|
|
|
|
ptypes "github.com/gogo/protobuf/types"
|
|
"github.com/prysmaticlabs/prysm/shared/params"
|
|
"google.golang.org/grpc/codes"
|
|
"google.golang.org/grpc/status"
|
|
)
|
|
|
|
// finalisedChangeUpdater this is a stub for the comming PRs #3133
|
|
// Store validator index to public key map Validate attestation signature.
|
|
func (s *Service) finalisedChangeUpdater() error {
|
|
secondsPerSlot := params.BeaconConfig().SecondsPerSlot
|
|
d := time.Duration(secondsPerSlot) * time.Second
|
|
tick := time.Tick(d)
|
|
var finalizedEpoch uint64
|
|
for {
|
|
select {
|
|
case <-tick:
|
|
ch, err := s.beaconClient.GetChainHead(s.context, &ptypes.Empty{})
|
|
if err != nil {
|
|
log.Error(err)
|
|
continue
|
|
}
|
|
if ch != nil {
|
|
if ch.FinalizedEpoch > finalizedEpoch {
|
|
log.Infof("Finalized epoch %d", ch.FinalizedEpoch)
|
|
}
|
|
continue
|
|
}
|
|
log.Error("No chain head was returned by beacon chain.")
|
|
case <-s.context.Done():
|
|
return status.Error(codes.Canceled, "Stream context canceled")
|
|
|
|
}
|
|
}
|
|
}
|