Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 1 addition & 2 deletions eth/stagedsync/stage_headers.go
Original file line number Diff line number Diff line change
Expand Up @@ -488,9 +488,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, hashToDownload, headerNumber, s, cfg)
return &privateapi.PayloadStatus{Status: remote.EngineStatus_SYNCING}, nil
}

Expand Down
8 changes: 6 additions & 2 deletions turbo/stages/headerdownload/header_algos.go
Original file line number Diff line number Diff line change
Expand Up @@ -432,12 +432,16 @@ func (hd *HeaderDownload) requestMoreHeadersForPOS(currentTime time.Time) (timeo
penalties = []PenaltyItem{{Penalty: AbandonedAnchorPenalty, PeerID: anchor.peerID}}
return
}
parentHeight := anchor.blockHeight - 1
if anchor.blockHeight == 0 {
parentHeight = 0
}

// Request ancestors
request = &HeaderRequest{
Anchor: anchor,
Hash: anchor.parentHash,
Number: 0, // Since posAnchor may be an estimate, do not specify it here
Number: parentHeight, // Since posAnchor may be an estimate, do not specify it here
Length: 192,
Skip: 0,
Reverse: true,
Expand Down Expand Up @@ -624,7 +628,7 @@ func (hd *HeaderDownload) SetHeaderToDownloadPoS(hash common.Hash, height uint64
hd.lock.Lock()
defer hd.lock.Unlock()

log.Debug("Set posAnchor", "blockHeight", height+1)
log.Debug("Set posAnchor", "blockHeight", height)
hd.posAnchor = &Anchor{
parentHash: hash,
blockHeight: height + 1,
Expand Down