mirror of
https://gitlab.com/pulsechaincom/prysm-pulse.git
synced 2025-01-05 01:04:29 +00:00
5a66807989
* First take at updating everything to v5 * Patch gRPC gateway to use prysm v5 Fix patch * Update go ssz --------- Co-authored-by: Preston Van Loon <pvanloon@offchainlabs.com>
28 lines
1017 B
Go
28 lines
1017 B
Go
package blockchain
|
|
|
|
import (
|
|
"github.com/prysmaticlabs/prysm/v5/beacon-chain/cache"
|
|
"github.com/prysmaticlabs/prysm/v5/beacon-chain/core/helpers"
|
|
"github.com/prysmaticlabs/prysm/v5/beacon-chain/state"
|
|
"github.com/prysmaticlabs/prysm/v5/config/features"
|
|
"github.com/prysmaticlabs/prysm/v5/consensus-types/primitives"
|
|
)
|
|
|
|
// trackedProposer returns whether the beacon node was informed, via the
|
|
// validators/prepare_proposer endpoint, of the proposer at the given slot.
|
|
// It only returns true if the tracked proposer is present and active.
|
|
func (s *Service) trackedProposer(st state.ReadOnlyBeaconState, slot primitives.Slot) (cache.TrackedValidator, bool) {
|
|
if features.Get().PrepareAllPayloads {
|
|
return cache.TrackedValidator{Active: true}, true
|
|
}
|
|
id, err := helpers.BeaconProposerIndexAtSlot(s.ctx, st, slot)
|
|
if err != nil {
|
|
return cache.TrackedValidator{}, false
|
|
}
|
|
val, ok := s.cfg.TrackedValidatorsCache.Validator(id)
|
|
if !ok {
|
|
return cache.TrackedValidator{}, false
|
|
}
|
|
return val, val.Active
|
|
}
|