Skip to content

Commit

Permalink
chore: reopen prefetcher
Browse files Browse the repository at this point in the history
  • Loading branch information
joeylichang committed Sep 30, 2024
1 parent 7bf9317 commit ffa6c04
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 13 deletions.
24 changes: 12 additions & 12 deletions core/blockchain.go
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down
2 changes: 1 addition & 1 deletion triedb/versiondb/versadb.go
Original file line number Diff line number Diff line change
Expand Up @@ -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)
}
Expand Down

0 comments on commit ffa6c04

Please sign in to comment.