mirror of
https://github.com/OffchainLabs/prysm.git
synced 2026-01-09 15:37:56 -05:00
Move aggregated attestation cache key generation outside locks (#15579)
This commit is contained in:
@@ -254,18 +254,22 @@ func (s *Service) validateBlockInAttestation(ctx context.Context, satt ethpb.Sig
|
||||
|
||||
// Returns true if the node has received aggregate for the aggregator with index and target epoch.
|
||||
func (s *Service) hasSeenAggregatorIndexEpoch(epoch primitives.Epoch, aggregatorIndex primitives.ValidatorIndex) bool {
|
||||
b := append(bytesutil.Bytes32(uint64(epoch)), bytesutil.Bytes32(uint64(aggregatorIndex))...)
|
||||
|
||||
s.seenAggregatedAttestationLock.RLock()
|
||||
defer s.seenAggregatedAttestationLock.RUnlock()
|
||||
b := append(bytesutil.Bytes32(uint64(epoch)), bytesutil.Bytes32(uint64(aggregatorIndex))...)
|
||||
|
||||
_, seen := s.seenAggregatedAttestationCache.Get(string(b))
|
||||
return seen
|
||||
}
|
||||
|
||||
// Set aggregate's aggregator index target epoch as seen.
|
||||
func (s *Service) setAggregatorIndexEpochSeen(epoch primitives.Epoch, aggregatorIndex primitives.ValidatorIndex) {
|
||||
b := append(bytesutil.Bytes32(uint64(epoch)), bytesutil.Bytes32(uint64(aggregatorIndex))...)
|
||||
|
||||
s.seenAggregatedAttestationLock.Lock()
|
||||
defer s.seenAggregatedAttestationLock.Unlock()
|
||||
b := append(bytesutil.Bytes32(uint64(epoch)), bytesutil.Bytes32(uint64(aggregatorIndex))...)
|
||||
|
||||
s.seenAggregatedAttestationCache.Add(string(b), true)
|
||||
}
|
||||
|
||||
|
||||
3
changelog/ttsao_move-cache-key-outside-locks.md
Normal file
3
changelog/ttsao_move-cache-key-outside-locks.md
Normal file
@@ -0,0 +1,3 @@
|
||||
### Changed
|
||||
|
||||
- Move aggregated attestation cache key generation outside of critical locks to improve performance
|
||||
Reference in New Issue
Block a user