2023-05-11 22:47:26 +00:00
|
|
|
package cache
|
|
|
|
|
|
|
|
import (
|
2023-05-14 22:12:24 +00:00
|
|
|
"github.com/ledgerwatch/erigon/cl/cltypes/solid"
|
2023-05-13 21:44:07 +00:00
|
|
|
"github.com/ledgerwatch/erigon/cl/phase1/core/state/lru"
|
2023-05-11 22:47:26 +00:00
|
|
|
)
|
|
|
|
|
2023-05-14 22:12:24 +00:00
|
|
|
var attestationIndiciesCache *lru.Cache[*solid.AttestationData, []uint64]
|
2023-05-11 22:47:26 +00:00
|
|
|
|
|
|
|
const attestationIndiciesCacheSize = 256
|
|
|
|
|
2023-05-14 22:12:24 +00:00
|
|
|
func LoadAttestatingIndicies(attestation *solid.AttestationData) ([]uint64, bool) {
|
2023-05-11 22:47:26 +00:00
|
|
|
return attestationIndiciesCache.Get(attestation)
|
|
|
|
}
|
|
|
|
|
2023-05-14 22:12:24 +00:00
|
|
|
func StoreAttestation(attestation *solid.AttestationData, indicies []uint64) {
|
2023-05-11 22:47:26 +00:00
|
|
|
attestationIndiciesCache.Add(attestation, indicies)
|
|
|
|
}
|