Skip to content

Commit

Permalink
chore: refine some code
Browse files Browse the repository at this point in the history
  • Loading branch information
will@2012 committed Jun 12, 2024
1 parent 00e8f9d commit 28bcfe0
Showing 1 changed file with 4 additions and 7 deletions.
11 changes: 4 additions & 7 deletions triedb/pathdb/difflayer.go
Original file line number Diff line number Diff line change
Expand Up @@ -166,19 +166,16 @@ func newDiffLayer(parent layer, root common.Hash, id uint64, block uint64, nodes
switch l := parent.(type) {
case *diskLayer:
dl.origin = l
dl.cache = &HashNodeCache{
cache: make(map[common.Hash]*RefTrieNode),
}
case *diffLayer:
dl.origin = l.origin
dl.origin = l.originDiskLayer()
dl.cache = l.cache
default:
panic("unknown parent type")
}

if dl.cache == nil {
dl.cache = &HashNodeCache{
cache: make(map[common.Hash]*RefTrieNode),
}
}

for _, subset := range nodes {
for path, n := range subset {
dl.memory += uint64(n.Size() + len(path))
Expand Down

0 comments on commit 28bcfe0

Please sign in to comment.