From dabaf392a7b87c80151845afd717256ef6ca5ee1 Mon Sep 17 00:00:00 2001 From: Daniel Liu <139250065@qq.com> Date: Tue, 17 Jun 2025 13:29:57 +0800 Subject: [PATCH] trie: fix size accounting in cleaner #25007 (#1093) Decrease children size instead of dirties size when marking dirties as cleaned up in trie cleaner Co-authored-by: aaronbuchwald --- trie/database.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/trie/database.go b/trie/database.go index bd09bbac20..43d5051889 100644 --- a/trie/database.go +++ b/trie/database.go @@ -806,7 +806,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 {