Merge pull request #22551 from karalabe/snapshot-parent-get-panic
core/state/snapshot: fix panic on missing parent
This commit is contained in:
commit
f304290b7d
@ -283,11 +283,11 @@ func (t *Tree) Update(blockRoot common.Hash, parentRoot common.Hash, destructs m
|
|||||||
return errSnapshotCycle
|
return errSnapshotCycle
|
||||||
}
|
}
|
||||||
// Generate a new snapshot on top of the parent
|
// Generate a new snapshot on top of the parent
|
||||||
parent := t.Snapshot(parentRoot).(snapshot)
|
parent := t.Snapshot(parentRoot)
|
||||||
if parent == nil {
|
if parent == nil {
|
||||||
return fmt.Errorf("parent [%#x] snapshot missing", parentRoot)
|
return fmt.Errorf("parent [%#x] snapshot missing", parentRoot)
|
||||||
}
|
}
|
||||||
snap := parent.Update(blockRoot, destructs, accounts, storage)
|
snap := parent.(snapshot).Update(blockRoot, destructs, accounts, storage)
|
||||||
|
|
||||||
// Save the new snapshot for later
|
// Save the new snapshot for later
|
||||||
t.lock.Lock()
|
t.lock.Lock()
|
||||||
|
Loading…
Reference in New Issue
Block a user