forked from cerc-io/plugeth
core, trie: flush preimages to db on blockchain close (#25533)
* core, trie: flush preimages to db on database close Co-authored-by: rjl493456442 <garyrong0905@gmail.com> * rename Close to CommitPreimages for clarity * core, trie: nitpick fixes Co-authored-by: rjl493456442 <garyrong0905@gmail.com> Co-authored-by: Péter Szilágyi <peterke@gmail.com>
This commit is contained in:
co-authored by
rjl493456442
Péter Szilágyi
parent
c4ab7d2291
commit
12185e40e0
@@ -893,6 +893,10 @@ func (bc *BlockChain) Stop() {
|
||||
log.Error("Dangling trie nodes after full cleanup")
|
||||
}
|
||||
}
|
||||
// Flush the collected preimages to disk
|
||||
if err := bc.stateCache.TrieDB().CommitPreimages(); err != nil {
|
||||
log.Error("Failed to commit trie preimages", "err", err)
|
||||
}
|
||||
// Ensure all live cached entries be saved into disk, so that we can skip
|
||||
// cache warmup when node restarts.
|
||||
if bc.cacheConfig.TrieCleanJournal != "" {
|
||||
|
||||
Reference in New Issue
Block a user