mirror of
https://gitlab.com/pulsechaincom/erigon-pulse.git
synced 2024-12-23 04:03:49 +00:00
Simplify code around topSeenHeight (#6529)
Co-authored-by: Alexey Sharp <alexeysharp@Alexeys-iMac.local>
This commit is contained in:
parent
e88a5aa2e8
commit
7243db8dbf
@ -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 {
|
||||
|
@ -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()
|
||||
|
@ -303,7 +303,6 @@ type HeaderDownload struct {
|
||||
headerReader services.HeaderReader
|
||||
|
||||
// Proof of Stake (PoS)
|
||||
topSeenHeightPoS uint64
|
||||
firstSeenHeightPoS *uint64
|
||||
requestId int
|
||||
posAnchor *Anchor
|
||||
|
Loading…
Reference in New Issue
Block a user