From a31f6d54dfd49e277b78017c3c5e34d544687f7f Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?P=C3=A9ter=20Szil=C3=A1gyi?= <peterke@gmail.com>
Date: Mon, 22 Mar 2021 22:41:28 +0200
Subject: [PATCH] core/state/snapshot: fix panic on missing parent

---
 core/state/snapshot/snapshot.go | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/core/state/snapshot/snapshot.go b/core/state/snapshot/snapshot.go
index aa5f5900b..810f1354e 100644
--- a/core/state/snapshot/snapshot.go
+++ b/core/state/snapshot/snapshot.go
@@ -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()
-- 
GitLab