mirror of
https://gitlab.com/pulsechaincom/erigon-pulse.git
synced 2025-01-11 05:20:05 +00:00
Inverted lowestNum and highestNum in header downloader (#3301)
Co-authored-by: Alexey Sharp <alexeysharp@Alexeys-iMac.local>
This commit is contained in:
parent
8287b3eda1
commit
6704c48ed7
@ -979,9 +979,9 @@ func (hi *HeaderInserter) BestHeaderChanged() bool {
|
||||
// speeds up visibility of new blocks
|
||||
// It remember peerID - then later - if anchors created from segments will abandoned - this peerID gonna get Penalty
|
||||
func (hd *HeaderDownload) ProcessSegment(segment ChainSegment, newBlock bool, peerID enode.ID) (requestMore bool, penalties []PenaltyItem) {
|
||||
lowestNum := segment[0].Number
|
||||
highest := segment[len(segment)-1]
|
||||
highestNum := highest.Number
|
||||
// ChainSegment is sorted in the order of descending block numbers, so the lowest is at the end, and the highest is in the beginning
|
||||
highestNum := segment[0].Number
|
||||
lowestNum := segment[len(segment)-1].Number
|
||||
log.Trace("processSegment", "from", lowestNum, "to", highestNum)
|
||||
hd.lock.Lock()
|
||||
defer hd.lock.Unlock()
|
||||
@ -997,7 +997,7 @@ func (hd *HeaderDownload) ProcessSegment(segment ChainSegment, newBlock bool, pe
|
||||
return
|
||||
}
|
||||
if highestNum > hd.topSeenHeightPoW {
|
||||
if newBlock || hd.seenAnnounces.Seen(highest.Hash) {
|
||||
if newBlock || hd.seenAnnounces.Seen(segment[0].Hash) {
|
||||
hd.topSeenHeightPoW = highestNum
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user