Skip to content

Commit

Permalink
Remove fastcache finalizer, not using fastcache
Browse files Browse the repository at this point in the history
This upstream PR removed use of fastcache in favor of a size-bounded
LRU cache
ethereum/go-ethereum#26162
  • Loading branch information
Tristan-Wilson committed Feb 28, 2023
1 parent 5061259 commit 11ec7fe
Showing 1 changed file with 0 additions and 8 deletions.
8 changes: 0 additions & 8 deletions core/state/database.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,6 @@ package state
import (
"errors"
"fmt"
"runtime"

"github.com/ethereum/go-ethereum/common"
"github.com/ethereum/go-ethereum/common/lru"
Expand Down Expand Up @@ -143,7 +142,6 @@ func NewDatabaseWithConfig(db ethdb.Database, config *trie.Config) Database {
codeCache: lru.NewSizeConstrainedCache[common.Hash, []byte](codeCacheSize),
triedb: trie.NewDatabaseWithConfig(db, config),
}
runtime.SetFinalizer(cdb, (*cachingDB).finalizer)
return cdb
}

Expand All @@ -155,7 +153,6 @@ func NewDatabaseWithNodeDB(db ethdb.Database, triedb *trie.Database) Database {
codeCache: lru.NewSizeConstrainedCache[common.Hash, []byte](codeCacheSize),
triedb: triedb,
}
runtime.SetFinalizer(cdb, (*cachingDB).finalizer)
return cdb
}

Expand All @@ -175,11 +172,6 @@ func (db *cachingDB) OpenTrie(root common.Hash) (Trie, error) {
return tr, nil
}

// fastcache chunks are not mannaged by GC.
func (db *cachingDB) finalizer() {
db.codeCache.Reset()
}

// OpenStorageTrie opens the storage trie of an account.
func (db *cachingDB) OpenStorageTrie(stateRoot common.Hash, addrHash, root common.Hash) (Trie, error) {
tr, err := trie.NewStateTrie(trie.StorageTrieID(stateRoot, addrHash, root), db.triedb)
Expand Down

0 comments on commit 11ec7fe

Please sign in to comment.