From 778d92c90313d4318216b72c0ee7f78bb9d5e029 Mon Sep 17 00:00:00 2001 From: aaronbuchwald Date: Tue, 21 Jun 2022 05:00:37 -0400 Subject: [PATCH] trie: fix size accounting in cleaner (#25007) Decrease children size instead of dirties size when marking dirties as cleaned up in trie cleaner --- trie/database.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/trie/database.go b/trie/database.go index 4167031a584c..2df2e859d7b4 100644 --- a/trie/database.go +++ b/trie/database.go @@ -812,7 +812,7 @@ func (c *cleaner) Put(key []byte, rlp []byte) error { delete(c.db.dirties, hash) c.db.dirtiesSize -= common.StorageSize(common.HashLength + int(node.size)) if node.children != nil { - c.db.dirtiesSize -= common.StorageSize(cachedNodeChildrenSize + len(node.children)*(common.HashLength+2)) + c.db.childrenSize -= common.StorageSize(cachedNodeChildrenSize + len(node.children)*(common.HashLength+2)) } // Move the flushed node into the clean cache to prevent insta-reloads if c.db.cleans != nil {