core/state/snapshot: fix panic on missing parent

This commit is contained in:
Péter Szilágyi 2021-03-22 22:41:28 +02:00
parent 8d6cc16742
commit a31f6d54df
No known key found for this signature in database
GPG Key ID: E9AE538CEDF8293D

View File

@ -283,11 +283,11 @@ func (t *Tree) Update(blockRoot common.Hash, parentRoot common.Hash, destructs m
return errSnapshotCycle
}
// Generate a new snapshot on top of the parent
parent := t.Snapshot(parentRoot).(snapshot)
parent := t.Snapshot(parentRoot)
if parent == nil {
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
t.lock.Lock()