From c8bbc3dc0ced2a696b14c5dbb0daa9ff7d63cc92 Mon Sep 17 00:00:00 2001 From: blxdyx <125243069+blxdyx@users.noreply.github.com> Date: Wed, 14 Aug 2024 14:53:29 +0800 Subject: [PATCH] stage_headers: fix uint underflow at parent request (#10618) (#482) Co-authored-by: Alex Sharov --- turbo/stages/headerdownload/header_algos.go | 3 +++ 1 file changed, 3 insertions(+) diff --git a/turbo/stages/headerdownload/header_algos.go b/turbo/stages/headerdownload/header_algos.go index 5ed7d632881..62dbb70b999 100644 --- a/turbo/stages/headerdownload/header_algos.go +++ b/turbo/stages/headerdownload/header_algos.go @@ -383,6 +383,9 @@ func (hd *HeaderDownload) RequestMoreHeaders(currentTime time.Time) (*HeaderRequ var penalties []PenaltyItem var req *HeaderRequest hd.anchorTree.Ascend(func(anchor *Anchor) bool { + if anchor.blockHeight == 0 { //has no parent + return true + } if anchor.nextRetryTime.After(currentTime) { // We are not ready to retry this anchor yet dataflow.HeaderDownloadStates.AddChange(anchor.blockHeight-1, dataflow.HeaderRetryNotReady)