core/snailchain.go: update the for loop in find common ancestor

This commit is contained in:
ywzqwwt 2019-02-22 15:09:51 +08:00
parent 5d16717fd3
commit 4702440eff

View file

@ -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())