From ed644a983d663bfa77874793b0afa97cd0cbe55f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?P=C3=A9ter=20Szil=C3=A1gyi?= Date: Tue, 5 Feb 2019 16:20:18 +0200 Subject: [PATCH] trie: move dirty data to clean cache on flush --- trie/database.go | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/trie/database.go b/trie/database.go index 6df1a7f79b..a7106b60db 100644 --- a/trie/database.go +++ b/trie/database.go @@ -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