From bd566977e80f0d1c71a4ec08f83f78410f54ba04 Mon Sep 17 00:00:00 2001
From: gary rong <garyrong0905@gmail.com>
Date: Tue, 6 Jul 2021 15:32:26 +0800
Subject: [PATCH] core: fix bad parent hash when jumping to genesis in setHead
 (#23162)

---
 core/headerchain.go | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/core/headerchain.go b/core/headerchain.go
index d9f3b575a..07307c710 100644
--- a/core/headerchain.go
+++ b/core/headerchain.go
@@ -574,7 +574,7 @@ func (hc *HeaderChain) SetHead(head uint64, updateFn UpdateHeadBlocksCallback, d
 		if parent == nil {
 			parent = hc.genesisHeader
 		}
-		parentHash = hdr.ParentHash
+		parentHash = parent.Hash()
 
 		// Notably, since geth has the possibility for setting the head to a low
 		// height which is even lower than ancient head.
-- 
GitLab