core/state/snapshot: reduce disk layer depth during generation
This commit is contained in:
@ -263,6 +263,13 @@ func (t *Tree) Cap(root common.Hash, layers int) error {
|
||||
if !ok {
|
||||
return fmt.Errorf("snapshot [%#x] is disk layer", root)
|
||||
}
|
||||
// If the generator is still running, use a more aggressive cap
|
||||
diff.origin.lock.RLock()
|
||||
if diff.origin.genMarker != nil && layers > 8 {
|
||||
layers = 8
|
||||
}
|
||||
diff.origin.lock.RUnlock()
|
||||
|
||||
// Run the internal capping and discard all stale layers
|
||||
t.lock.Lock()
|
||||
defer t.lock.Unlock()
|
||||
|
Reference in New Issue
Block a user