From 4702440eff296a22d7af9f96370942e861a278b1 Mon Sep 17 00:00:00 2001 From: ywzqwwt <752252086@qq.com> Date: Fri, 22 Feb 2019 15:09:51 +0800 Subject: [PATCH] core/snailchain.go: update the for loop in find common ancestor --- core/blockchain.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/core/blockchain.go b/core/blockchain.go index 54ca6d33d4..3d11f912b3 100644 --- a/core/blockchain.go +++ b/core/blockchain.go @@ -1340,7 +1340,7 @@ func (bc *BlockChain) insertSidechain(it *insertIterator) (int, []interface{}, [ numbers []uint64 ) parent := bc.GetHeader(it.previous().Hash(), it.previous().NumberU64()) - for parent != nil && !bc.HasState(parent.Root) { + for parent != nil && rawdb.ReadCanonicalHash(bc.db, parent.Number.Uint64()) != parent.Hash() { hashes = append(hashes, parent.Hash()) numbers = append(numbers, parent.Number.Uint64())