Skip to content

Commit 86183a8

Browse files
committed
fix the race condition by using lru.Cache
Signed-off-by: Guillaume Ballet <[email protected]>
1 parent 7fd5179 commit 86183a8

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

core/state/database.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -201,7 +201,7 @@ type CachingDB struct {
201201
pointCache *utils.PointCache
202202

203203
// Transition-specific fields
204-
TransitionStatePerRoot lru.BasicLRU[common.Hash, *TransitionState]
204+
TransitionStatePerRoot *lru.Cache[common.Hash, *TransitionState]
205205
}
206206

207207
// NewDatabase creates a state database with the provided data sources.
@@ -213,7 +213,7 @@ func NewDatabase(triedb *triedb.Database, snap *snapshot.Tree) *CachingDB {
213213
codeCache: lru.NewSizeConstrainedCache[common.Hash, []byte](codeCacheSize),
214214
codeSizeCache: lru.NewCache[common.Hash, int](codeSizeCacheSize),
215215
pointCache: utils.NewPointCache(pointCacheSize),
216-
TransitionStatePerRoot: lru.NewBasicLRU[common.Hash, *TransitionState](1000),
216+
TransitionStatePerRoot: lru.NewCache[common.Hash, *TransitionState](1000),
217217
}
218218
}
219219

0 commit comments

Comments
 (0)