diff --git a/eth/downloader/downloader.go b/eth/downloader/downloader.go index 09837a3045..dc4fb425a6 100644 --- a/eth/downloader/downloader.go +++ b/eth/downloader/downloader.go @@ -485,6 +485,12 @@ func (d *Downloader) syncToHead() (err error) { if mode == ethconfig.SnapSync { if height <= uint64(fsMinFullBlocks) { origin = 0 + // For genesis block, switch to full sync + if height == 0 { + mode = ethconfig.FullSync + d.mode.Store(uint32(mode)) + log.Info("Switching to full sync for genesis block") + } } else { pivotNumber := pivot.Number.Uint64() if pivotNumber <= origin { diff --git a/eth/handler.go b/eth/handler.go index aaea00e037..a4636e52a9 100644 --- a/eth/handler.go +++ b/eth/handler.go @@ -177,7 +177,11 @@ func newHandler(config *handlerConfig) (*handler, error) { } } else { head := h.chain.CurrentBlock() - if head.Number.Uint64() > 0 && h.chain.HasState(head.Root) { + if head.Number.Uint64() == 0 { + // For genesis block, always use full sync + h.snapSync.Store(false) + log.Info("Using full sync for genesis block") + } else if head.Number.Uint64() > 0 && h.chain.HasState(head.Root) { // Print warning log if database is not empty to run snap sync. log.Warn("Switch sync mode from snap sync to full sync", "reason", "snap sync complete") } else {