From 132168c28f9944c39a1a1e0a315c0f0046ce712b 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 c853dfe516..4e2f41b38a 100644 --- a/trie/database.go +++ b/trie/database.go @@ -769,6 +769,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