mirror of
https://gitlab.com/pulsechaincom/prysm-pulse.git
synced 2024-12-22 19:40:37 +00:00
b7e0819f00
* init - getLocalPayload does not use the proposer ID from the cache but takes it from the block - Fixed tests in blockchain package - Fixed tests in the RPC package - Fixed spectests EpochProposers takes 256 bytes that can be avoided to be copied, but this optimization is not clear to be worth it. assginmentStatus can be optimized to use the cached version from the TrackedValidatorsCache We shouldn't cache the proposer duties when calling getDuties but when we update the epoch boundary instead * track validators on prepare proposers * more rpc tests * more rpc tests * initialize grpc caches * Add back fcu log Also fix two existing bugs wrong parent hash on pre Capella and wrong blockhashes on altair * use beacon default fee recipient if there is none in the vc * fix validator test * radek's review * push always proposer settings even if no flag is specified in the VC * Only register with the builder if the VC flag is set Great find by @terencechain * add regression test * Radek's review * change signature of registration builder
44 lines
994 B
Go
44 lines
994 B
Go
package cache
|
|
|
|
import (
|
|
"sync"
|
|
|
|
"github.com/prysmaticlabs/prysm/v4/consensus-types/primitives"
|
|
)
|
|
|
|
type TrackedValidator struct {
|
|
Active bool
|
|
FeeRecipient primitives.ExecutionAddress
|
|
Index primitives.ValidatorIndex
|
|
}
|
|
|
|
type TrackedValidatorsCache struct {
|
|
sync.Mutex
|
|
trackedValidators map[primitives.ValidatorIndex]TrackedValidator
|
|
}
|
|
|
|
func NewTrackedValidatorsCache() *TrackedValidatorsCache {
|
|
return &TrackedValidatorsCache{
|
|
trackedValidators: make(map[primitives.ValidatorIndex]TrackedValidator),
|
|
}
|
|
}
|
|
|
|
func (t *TrackedValidatorsCache) Validator(index primitives.ValidatorIndex) (TrackedValidator, bool) {
|
|
t.Lock()
|
|
defer t.Unlock()
|
|
val, ok := t.trackedValidators[index]
|
|
return val, ok
|
|
}
|
|
|
|
func (t *TrackedValidatorsCache) Set(val TrackedValidator) {
|
|
t.Lock()
|
|
defer t.Unlock()
|
|
t.trackedValidators[val.Index] = val
|
|
}
|
|
|
|
func (t *TrackedValidatorsCache) Prune() {
|
|
t.Lock()
|
|
defer t.Unlock()
|
|
t.trackedValidators = make(map[primitives.ValidatorIndex]TrackedValidator)
|
|
}
|