simplify path layerTree logic

This commit is contained in:
maskpp 2024-04-25 18:04:40 +08:00
parent f3c389052e
commit 691291b42b

View file

@ -186,8 +186,8 @@ func (tree *layerTree) cap(root common.Hash, layers int) error {
delete(children, root) delete(children, root)
} }
// diskLayer only has one and is the bottom layer. // diskLayer only has one and is the bottom layer.
if dl := tree.bottom(); dl.isStale() { if dl := tree.bottom(); dl != nil && dl.isStale() {
remove(root) remove(dl.root)
} }
return nil return nil
} }