mirror of
https://gitlab.com/pulsechaincom/erigon-pulse.git
synced 2025-01-08 20:11:21 +00:00
Reverse relaxation of header downloader (#4064)
* Undo headers relaxation change * Undo headers relaxation change Co-authored-by: Alex Sharp <alexsharp@Alexs-MacBook-Pro.local>
This commit is contained in:
parent
f590bf682f
commit
7c2a7150bb
@ -241,8 +241,8 @@ func (hd *HeaderDownload) MarkPreverified(link *Link) {
|
||||
if !link.persisted {
|
||||
link.verified = true
|
||||
hd.moveLinkToQueue(link, InsertQueueID)
|
||||
link = hd.links[link.header.ParentHash]
|
||||
}
|
||||
link = hd.links[link.header.ParentHash]
|
||||
}
|
||||
}
|
||||
|
||||
@ -275,12 +275,14 @@ func (hd *HeaderDownload) extendUp(segment ChainSegment, attachmentLink *Link) {
|
||||
prevLink := attachmentLink
|
||||
for i := len(segment) - 1; i >= 0; i-- {
|
||||
link := hd.addHeaderAsLink(segment[i], false /* persisted */)
|
||||
if prevLink.persisted {
|
||||
// If we are attching to already persisted link, schedule for insertion (persistence)
|
||||
if link.verified {
|
||||
hd.moveLinkToQueue(link, InsertQueueID)
|
||||
} else {
|
||||
hd.moveLinkToQueue(link, VerifyQueueID)
|
||||
}
|
||||
}
|
||||
prevLink.next = append(prevLink.next, link)
|
||||
prevLink = link
|
||||
if _, ok := hd.preverifiedHashes[link.hash]; ok {
|
||||
@ -363,11 +365,13 @@ func (hd *HeaderDownload) connect(segment ChainSegment, attachmentLink *Link, an
|
||||
for i := len(segment) - 1; i >= 0; i-- {
|
||||
link := hd.addHeaderAsLink(segment[i], false /* persisted */)
|
||||
// If we attach to already persisted link, mark this one for insertion
|
||||
if prevLink.persisted {
|
||||
if link.verified {
|
||||
hd.moveLinkToQueue(link, InsertQueueID)
|
||||
} else {
|
||||
hd.moveLinkToQueue(link, VerifyQueueID)
|
||||
}
|
||||
}
|
||||
prevLink.next = append(prevLink.next, link)
|
||||
prevLink = link
|
||||
if _, ok := hd.preverifiedHashes[link.hash]; ok {
|
||||
|
Loading…
Reference in New Issue
Block a user