mirror of
https://github.com/ethereum/go-ethereum.git
synced 2026-08-19 10:22:23 +00:00
core/state/snapshot : use mark stale in different layer
This commit is contained in:
parent
d71831255d
commit
921fa574a6
2 changed files with 10 additions and 6 deletions
|
|
@ -541,3 +541,11 @@ func (dl *diffLayer) StorageList(accountHash common.Hash) ([]common.Hash, bool)
|
||||||
dl.memory += uint64(len(dl.storageList)*common.HashLength + common.HashLength)
|
dl.memory += uint64(len(dl.storageList)*common.HashLength + common.HashLength)
|
||||||
return storageList, destructed
|
return storageList, destructed
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// markStale sets the stale flag as true.
|
||||||
|
func (dl *diffLayer) markStale() {
|
||||||
|
dl.lock.Lock()
|
||||||
|
defer dl.lock.Unlock()
|
||||||
|
|
||||||
|
dl.stale.Store(true)
|
||||||
|
}
|
||||||
|
|
|
||||||
|
|
@ -266,9 +266,7 @@ func (t *Tree) Disable() {
|
||||||
|
|
||||||
case *diffLayer:
|
case *diffLayer:
|
||||||
// If the layer is a simple diff, simply mark as stale
|
// If the layer is a simple diff, simply mark as stale
|
||||||
layer.lock.Lock()
|
layer.markStale()
|
||||||
layer.stale.Store(true)
|
|
||||||
layer.lock.Unlock()
|
|
||||||
|
|
||||||
default:
|
default:
|
||||||
panic(fmt.Sprintf("unknown layer type: %T", layer))
|
panic(fmt.Sprintf("unknown layer type: %T", layer))
|
||||||
|
|
@ -725,9 +723,7 @@ func (t *Tree) Rebuild(root common.Hash) {
|
||||||
|
|
||||||
case *diffLayer:
|
case *diffLayer:
|
||||||
// If the layer is a simple diff, simply mark as stale
|
// If the layer is a simple diff, simply mark as stale
|
||||||
layer.lock.Lock()
|
layer.markStale()
|
||||||
layer.stale.Store(true)
|
|
||||||
layer.lock.Unlock()
|
|
||||||
|
|
||||||
default:
|
default:
|
||||||
panic(fmt.Sprintf("unknown layer type: %T", layer))
|
panic(fmt.Sprintf("unknown layer type: %T", layer))
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue