Skip to content

Commit

Permalink
core/state/snapshot: fix panic on missing parent
Browse files Browse the repository at this point in the history
  • Loading branch information
karalabe committed Mar 22, 2021
1 parent 8d6cc16 commit a31f6d5
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions core/state/snapshot/snapshot.go
Original file line number Diff line number Diff line change
Expand Up @@ -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()
Expand Down

0 comments on commit a31f6d5

Please sign in to comment.