From 86183a83738c33ffccc0bb4e18e677b9d27e7340 Mon Sep 17 00:00:00 2001 From: Guillaume Ballet <3272758+gballet@users.noreply.github.com> Date: Mon, 14 Jul 2025 11:37:43 +0200 Subject: [PATCH] fix the race condition by using lru.Cache Signed-off-by: Guillaume Ballet <3272758+gballet@users.noreply.github.com> --- core/state/database.go | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/core/state/database.go b/core/state/database.go index 22f2accd88..3cb9a78d55 100644 --- a/core/state/database.go +++ b/core/state/database.go @@ -201,7 +201,7 @@ type CachingDB struct { pointCache *utils.PointCache // 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. @@ -213,7 +213,7 @@ func NewDatabase(triedb *triedb.Database, snap *snapshot.Tree) *CachingDB { codeCache: lru.NewSizeConstrainedCache[common.Hash, []byte](codeCacheSize), codeSizeCache: lru.NewCache[common.Hash, int](codeSizeCacheSize), pointCache: utils.NewPointCache(pointCacheSize), - TransitionStatePerRoot: lru.NewBasicLRU[common.Hash, *TransitionState](1000), + TransitionStatePerRoot: lru.NewCache[common.Hash, *TransitionState](1000), } }