core: flush trie db if memory data size or processing time exceeds the limit

This commit is contained in:
rjl493456442 2018-03-01 18:21:36 +08:00
parent a1984ce727
commit 888e165dd1

View file

@ -932,7 +932,7 @@ func (bc *BlockChain) WriteBlockWithState(block *types.Block, receipts []*types.
}
}
// If optimum or critical limits reached, write to disk
if chosen >= lastWrite+triesInMemory || size >= 2*limit || bc.gcproc >= 2*bc.cacheConfig.TrieTimeLimit {
if chosen >= lastWrite+triesInMemory || size >= limit || bc.gcproc >= bc.cacheConfig.TrieTimeLimit {
triedb.Commit(header.Root, true)
lastWrite = chosen
bc.gcproc = 0