[ethereum/go-ethereum] core, eth, trie: streaming GC for the trie cache (#16810)

karalabe commented on this pull request.

> + db.preimages = make(map[common.Hash][]byte)
+ db.preimagesSize = 0
+ }
+ for db.oldest != oldest {
+ node := db.nodes[db.oldest]
+ delete(db.nodes, db.oldest)
+ db.oldest = node.flushNext
+
+ db.nodesSize -= common.StorageSize(common.HashLength + len(node.blob))
+ }
+ if db.oldest != (common.Hash{}) {
+ db.nodes[db.oldest].flushPrev = common.Hash{}
+ }
+ db.flushnodes += uint64(nodes — len(db.nodes))
+ db.flushsize += storage — db.nodesSize
+ db.flushtime += time.Since(start)

Added them.

Добавить комментарий