trie: move dirty data to clean cache on flush

This commit is contained in:
Péter Szilágyi 2019-02-05 16:20:18 +02:00
parent f03402232c
commit ed644a983d
No known key found for this signature in database
GPG key ID: E9AE538CEDF8293D

View file

@ -784,6 +784,11 @@ func (db *Database) uncache(hash common.Hash) {
}
delete(db.dirties, hash)
db.dirtiesSize -= common.StorageSize(common.HashLength + int(node.size))
// Move the flushed node into the clean cache to prevent insta-reloads
if db.cleans != nil {
db.cleans.Set(string(hash[:]), node.rlp())
}
}
// Size returns the current storage size of the memory cache in front of the