Revert "Using full sync for genesis block"

This reverts commit a1b02725b536716c5b4f5a6559260cc067772d7a.
This commit is contained in:
Monkey 2025-05-15 01:45:01 +08:00 committed by Guillaume Ballet
parent 58bdd555c7
commit d7d59ebb93
2 changed files with 1 additions and 11 deletions

View file

@ -485,12 +485,6 @@ func (d *Downloader) syncToHead() (err error) {
if mode == ethconfig.SnapSync { if mode == ethconfig.SnapSync {
if height <= uint64(fsMinFullBlocks) { if height <= uint64(fsMinFullBlocks) {
origin = 0 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 { } else {
pivotNumber := pivot.Number.Uint64() pivotNumber := pivot.Number.Uint64()
if pivotNumber <= origin { if pivotNumber <= origin {

View file

@ -177,11 +177,7 @@ func newHandler(config *handlerConfig) (*handler, error) {
} }
} else { } else {
head := h.chain.CurrentBlock() head := h.chain.CurrentBlock()
if head.Number.Uint64() == 0 { if head.Number.Uint64() > 0 && h.chain.HasState(head.Root) {
// 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. // 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") log.Warn("Switch sync mode from snap sync to full sync", "reason", "snap sync complete")
} else { } else {