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 cp-wjhan committed Jun 26, 2023
1 parent 34c0ea1 commit ca62392
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 @@ -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 {
Expand Down

0 comments on commit ca62392

Please sign in to comment.