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 <aaron.buchwald56@gmail.com>
This commit is contained in:
Daniel Liu 2025-06-17 13:29:57 +08:00 committed by GitHub
parent e4de0e82a2
commit dabaf392a7
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -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 {