Skip to content

Commit

Permalink
trie: fix size accounting in cleaner (ethereum#25007)
Browse files Browse the repository at this point in the history
Decrease children size instead of dirties size when marking dirties as cleaned up in trie cleaner
  • Loading branch information
aaronbuchwald authored and qinglin89 committed Oct 21, 2022
1 parent ce9dae2 commit fafc29f
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion trie/database.go
Original file line number Diff line number Diff line change
Expand Up @@ -838,7 +838,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 {
Expand Down

0 comments on commit fafc29f

Please sign in to comment.