diff --git a/core/blockchain.go b/core/blockchain.go index 4dd9b7f54d..aa120aae7a 100644 --- a/core/blockchain.go +++ b/core/blockchain.go @@ -2368,18 +2368,18 @@ func (bc *BlockChain) insertChain(chain types.Blocks, setHead bool) (int, error) //statedb.StartPrefetcher("chain") interruptCh := make(chan struct{}) // For diff sync, it may fallback to full sync, so we still do prefetch - //if len(block.Transactions()) >= prefetchTxNumber { - // do Prefetch in a separate goroutine to avoid blocking the critical path - - //1.do state prefetch for snapshot cache - //throwaway := statedb.CopyDoPrefetch() - //go bc.prefetcher.Prefetch(block, throwaway, &bc.vmConfig, interruptCh) - - // // 2.do trie prefetch for MPT trie node cache - // // it is for the big state trie tree, prefetch based on transaction's From/To address. - // // trie prefetcher is thread safe now, ok to prefetch in a separate routine - // go throwaway.TriePrefetchInAdvance(block, signer) - //} + if len(block.Transactions()) >= prefetchTxNumber { + // do Prefetch in a separate goroutine to avoid blocking the critical path + + //1.do state prefetch for snapshot cache + throwaway := statedb.CopyDoPrefetch() + go bc.prefetcher.Prefetch(block, throwaway, &bc.vmConfig, interruptCh) + + // // 2.do trie prefetch for MPT trie node cache + // // it is for the big state trie tree, prefetch based on transaction's From/To address. + // // trie prefetcher is thread safe now, ok to prefetch in a separate routine + // go throwaway.TriePrefetchInAdvance(block, signer) + } // Process block using the parent state as reference point if bc.pipeCommit { diff --git a/triedb/versiondb/versadb.go b/triedb/versiondb/versadb.go index 1d7d7f9b9f..e932693523 100644 --- a/triedb/versiondb/versadb.go +++ b/triedb/versiondb/versadb.go @@ -37,7 +37,7 @@ func New(config *Config) *VersionDB { // } // _ = cfg //} - db, err := versa.NewVersaDB(path, nil) + db, err := versa.NewVersaDB(path, &versa.VersaDBConfig{}) if err != nil { log.Crit("failed to new version db", "error", err) }