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 maoueh committed Nov 29, 2022
1 parent 785f813 commit d473371
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 @@ -841,7 +841,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 d473371

Please sign in to comment.