From 955727181be3d4f6d919440f9709e3bf736ff8a4 Mon Sep 17 00:00:00 2001
From: Zou Guangxian <zouguangxian@gmail.com>
Date: Sat, 27 Mar 2021 01:06:25 +0800
Subject: [PATCH] eth: fix corner case in sync head determination (#21695)

This avoids synchronisation failures when the local header is ahead of
the local full block.
---
 eth/sync.go | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/eth/sync.go b/eth/sync.go
index dc72e8838..4520ec687 100644
--- a/eth/sync.go
+++ b/eth/sync.go
@@ -289,8 +289,8 @@ func (cs *chainSyncer) modeAndLocalHead() (downloader.SyncMode, *big.Int) {
 		}
 	}
 	// Nope, we're really full syncing
-	head := cs.handler.chain.CurrentHeader()
-	td := cs.handler.chain.GetTd(head.Hash(), head.Number.Uint64())
+	head := cs.handler.chain.CurrentBlock()
+	td := cs.handler.chain.GetTd(head.Hash(), head.NumberU64())
 	return downloader.FullSync, td
 }
 
-- 
GitLab