diff --git a/eth/stagedsync/stage_headers.go b/eth/stagedsync/stage_headers.go index b982d87c421..e8a4b7f863b 100644 --- a/eth/stagedsync/stage_headers.go +++ b/eth/stagedsync/stage_headers.go @@ -305,9 +305,8 @@ func startHandlingForkChoice( if header == nil { log.Info(fmt.Sprintf("[%s] Fork choice missing header with hash %x", s.LogPrefix(), headerHash)) - hashToDownload := headerHash cfg.hd.SetPoSDownloaderTip(headerHash) - schedulePoSDownload(requestId, hashToDownload, 0 /* header height is unknown, setting to 0 */, s, cfg) + schedulePoSDownload(requestId, headerHash, 0 /* header height is unknown, setting to 0 */, s, cfg) return &privateapi.PayloadStatus{Status: remote.EngineStatus_SYNCING}, nil } @@ -487,10 +486,8 @@ func handleNewPayload( } if parent == nil { log.Info(fmt.Sprintf("[%s] New payload missing parent", s.LogPrefix())) - hashToDownload := header.ParentHash - heightToDownload := headerNumber - 1 cfg.hd.SetPoSDownloaderTip(headerHash) - schedulePoSDownload(requestId, hashToDownload, heightToDownload, s, cfg) + schedulePoSDownload(requestId, header.ParentHash, headerNumber-1, s, cfg) return &privateapi.PayloadStatus{Status: remote.EngineStatus_SYNCING}, nil } @@ -629,7 +626,7 @@ func schedulePoSDownload( cfg.hd.SetRequestId(requestId) cfg.hd.SetHeaderToDownloadPoS(hashToDownload, heightToDownload) - cfg.hd.SetPOSSync(true) // This needs to be called afrer SetHeaderToDownloadPOS because SetHeaderToDownloadPOS sets `posAnchor` member field which is used by ProcessHeadersPOS + cfg.hd.SetPOSSync(true) // This needs to be called after SetHeaderToDownloadPOS because SetHeaderToDownloadPOS sets `posAnchor` member field which is used by ProcessHeadersPOS //nolint headerCollector := etl.NewCollector(s.LogPrefix(), cfg.tmpdir, etl.NewSortableBuffer(etl.BufferOptimalSize)) diff --git a/turbo/engineapi/fork_validator.go b/turbo/engineapi/fork_validator.go index 7fc99f5d1ae..a1ae9a1b85c 100644 --- a/turbo/engineapi/fork_validator.go +++ b/turbo/engineapi/fork_validator.go @@ -228,7 +228,6 @@ func (fv *ForkValidator) ValidatePayload(tx kv.RwTx, header *types.Header, body // if the block is not in range of maxForkDepth from head then we do not validate it. if abs64(int64(fv.currentHeight)-header.Number.Int64()) > maxForkDepth { status = remote.EngineStatus_ACCEPTED - fmt.Println("not in range") return } // Let's assemble the side fork backwards diff --git a/turbo/stages/headerdownload/header_algos.go b/turbo/stages/headerdownload/header_algos.go index 131b3b641ee..1f9d9f83808 100644 --- a/turbo/stages/headerdownload/header_algos.go +++ b/turbo/stages/headerdownload/header_algos.go @@ -437,7 +437,7 @@ func (hd *HeaderDownload) requestMoreHeadersForPOS(currentTime time.Time) (timeo request = &HeaderRequest{ Anchor: anchor, Hash: anchor.parentHash, - Number: 0, // Since posAnchor may be an estimate, do not specify it here + Number: anchor.blockHeight - 1, Length: 192, Skip: 0, Reverse: true,