Simplify code around topSeenHeight (#6529)

Co-authored-by: Alexey Sharp <alexeysharp@Alexeys-iMac.local>
This commit is contained in:
ledgerwatch 2023-01-09 06:42:26 +00:00 committed by GitHub
parent e88a5aa2e8
commit 7243db8dbf
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 0 additions and 21 deletions

View File

@ -352,7 +352,6 @@ func startHandlingForkChoice(
}
}
cfg.hd.UpdateTopSeenHeightPoS(headerNumber)
forkingPoint, err := forkingPoint(ctx, tx, headerInserter, cfg.blockReader, header)
if err != nil {
return nil, err
@ -476,7 +475,6 @@ func handleNewPayload(
headerHash := block.Hash()
log.Info(fmt.Sprintf("[%s] Handling new payload", s.LogPrefix()), "height", headerNumber, "hash", headerHash)
cfg.hd.UpdateTopSeenHeightPoS(headerNumber)
parent, err := cfg.blockReader.HeaderByHash(ctx, tx, header.ParentHash)
if err != nil {

View File

@ -1063,24 +1063,6 @@ func (hd *HeaderDownload) SetFirstPoSHeight(blockHeight uint64) {
}
}
func (hd *HeaderDownload) TopSeenHeight() uint64 {
hd.lock.RLock()
defer hd.lock.RUnlock()
if hd.topSeenHeightPoW > hd.topSeenHeightPoS {
return hd.topSeenHeightPoW
} else {
return hd.topSeenHeightPoS
}
}
func (hd *HeaderDownload) UpdateTopSeenHeightPoS(blockHeight uint64) {
hd.lock.Lock()
defer hd.lock.Unlock()
if blockHeight > hd.topSeenHeightPoS {
hd.topSeenHeightPoS = blockHeight
}
}
func (hd *HeaderDownload) SetHeaderReader(headerReader consensus.ChainHeaderReader) {
hd.lock.Lock()
defer hd.lock.Unlock()

View File

@ -303,7 +303,6 @@ type HeaderDownload struct {
headerReader services.HeaderReader
// Proof of Stake (PoS)
topSeenHeightPoS uint64
firstSeenHeightPoS *uint64
requestId int
posAnchor *Anchor