mirror of
https://gitlab.com/pulsechaincom/erigon-pulse.git
synced 2024-12-22 19:50:36 +00:00
Fix for goerli resync (#5269)
* Fix for goerli resync * Fix * Fix lint Co-authored-by: Alexey Sharp <alexeysharp@Alexeys-iMac.local>
This commit is contained in:
parent
c9ae7310e9
commit
da90c9752e
@ -412,10 +412,10 @@ func (cs *MultiClient) blockHeaders(ctx context.Context, pkt eth.BlockHeadersPac
|
||||
if cs.Hd.POSSync() {
|
||||
sort.Sort(headerdownload.HeadersReverseSort(csHeaders)) // Sorting by reverse order of block heights
|
||||
tx, err := cs.db.BeginRo(ctx)
|
||||
defer tx.Rollback()
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
defer tx.Rollback()
|
||||
penalties, err := cs.Hd.ProcessHeadersPOS(csHeaders, tx, ConvertH512ToPeerID(peerID))
|
||||
if err != nil {
|
||||
return err
|
||||
|
@ -968,10 +968,16 @@ func (br *BlockRetire) Result() *BlockRetireResult {
|
||||
return r
|
||||
}
|
||||
func CanRetire(curBlockNum uint64, snapshots *RoSnapshots) (blockFrom, blockTo uint64, can bool) {
|
||||
if curBlockNum <= params.FullImmutabilityThreshold {
|
||||
return
|
||||
}
|
||||
blockFrom = snapshots.BlocksAvailable() + 1
|
||||
return canRetire(blockFrom, curBlockNum-params.FullImmutabilityThreshold)
|
||||
}
|
||||
func canRetire(from, to uint64) (blockFrom, blockTo uint64, can bool) {
|
||||
if to <= from {
|
||||
return
|
||||
}
|
||||
blockFrom = (from / 1_000) * 1_000
|
||||
roundedTo1K := (to / 1_000) * 1_000
|
||||
var maxJump uint64 = 1_000
|
||||
|
Loading…
Reference in New Issue
Block a user