mirror of
https://github.com/ethereum/go-ethereum.git
synced 2026-07-25 14:16:44 +00:00
fix the race condition by using lru.Cache
Signed-off-by: Guillaume Ballet <3272758+gballet@users.noreply.github.com>
This commit is contained in:
parent
7fd5179029
commit
86183a8373
1 changed files with 2 additions and 2 deletions
|
|
@ -201,7 +201,7 @@ type CachingDB struct {
|
||||||
pointCache *utils.PointCache
|
pointCache *utils.PointCache
|
||||||
|
|
||||||
// Transition-specific fields
|
// Transition-specific fields
|
||||||
TransitionStatePerRoot lru.BasicLRU[common.Hash, *TransitionState]
|
TransitionStatePerRoot *lru.Cache[common.Hash, *TransitionState]
|
||||||
}
|
}
|
||||||
|
|
||||||
// NewDatabase creates a state database with the provided data sources.
|
// NewDatabase creates a state database with the provided data sources.
|
||||||
|
|
@ -213,7 +213,7 @@ func NewDatabase(triedb *triedb.Database, snap *snapshot.Tree) *CachingDB {
|
||||||
codeCache: lru.NewSizeConstrainedCache[common.Hash, []byte](codeCacheSize),
|
codeCache: lru.NewSizeConstrainedCache[common.Hash, []byte](codeCacheSize),
|
||||||
codeSizeCache: lru.NewCache[common.Hash, int](codeSizeCacheSize),
|
codeSizeCache: lru.NewCache[common.Hash, int](codeSizeCacheSize),
|
||||||
pointCache: utils.NewPointCache(pointCacheSize),
|
pointCache: utils.NewPointCache(pointCacheSize),
|
||||||
TransitionStatePerRoot: lru.NewBasicLRU[common.Hash, *TransitionState](1000),
|
TransitionStatePerRoot: lru.NewCache[common.Hash, *TransitionState](1000),
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue