Skip to content

Commit 6abc2ff

Browse files
[SharovBot] chore: weekly code cleanup consolidation (erigontech#21811)
**[SharovBot]** 🧹 Weekly Code Cleanup — June 15th, 2026 This PR consolidates the following small cleanup changes that were individually submitted as PRs this week: | Original PR | Description | |------------|-------------| | erigontech#21587 | refactor: use the built-in max to simplify the code | Changes that could not be applied due to conflicts: - erigontech#21346: patch does not apply (file context drift in `node/components/storage/snapshot/inventory.go`) - erigontech#21588: patch does not apply (file context drift in `cmd/utils/flags.go`) - erigontech#21589: patch does not apply (`p2p/sentry/sentry_multi_client/bal_downloader.go` not found — likely moved or renamed) --- *Automated weekly consolidation by SharovBot.* Co-authored-by: erigon-copilot[bot] <erigon-copilot[bot]@users.noreply.github.com> Co-authored-by: Giulio Rebuffo <giulio.rebuffo@gmail.com>
1 parent 692130b commit 6abc2ff

3 files changed

Lines changed: 3 additions & 12 deletions

File tree

cl/phase1/execution_client/block_collector/persistent_block_collector.go

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -312,10 +312,7 @@ func (p *PersistentBlockCollector) Flush(ctx context.Context) error {
312312
// Use a non-cancelable context: if ctx was cancelled the caller cares
313313
// about stopping, but skipping cleanup would leave already-inserted
314314
// rows in place and the next Flush would re-read and re-insert them.
315-
cutoff := minInsertableBlockNumber
316-
if lastCommittedHeight+1 > cutoff {
317-
cutoff = lastCommittedHeight + 1
318-
}
315+
cutoff := max(lastCommittedHeight+1, minInsertableBlockNumber)
319316
if err := p.db.Update(context.Background(), func(tx kv.RwTx) error {
320317
cursor, err := tx.RwCursor(kv.Headers)
321318
if err != nil {

cl/phase1/network/beacon_downloader.go

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -213,10 +213,7 @@ func (f *ForwardBeaconDownloader) RequestMore(ctx context.Context) {
213213
}
214214
}
215215

216-
backoff := baseInterval * time.Duration(1<<uint(min(failures, 4)))
217-
if backoff > 5*time.Second {
218-
backoff = 5 * time.Second
219-
}
216+
backoff := min(baseInterval*time.Duration(1<<uint(min(failures, 4))), 5*time.Second)
220217
reqInterval.Reset(backoff)
221218
return
222219
}

cl/sentinel/handlers/blocks_by_head.go

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -31,10 +31,7 @@ func (c *ConsensusHandlers) beaconBlocksByHeadHandler(s network.Stream) error {
3131
return err
3232
}
3333

34-
count := req.Count
35-
if count > c.beaconConfig.MaxRequestBlocksDeneb {
36-
count = c.beaconConfig.MaxRequestBlocksDeneb
37-
}
34+
count := min(req.Count, c.beaconConfig.MaxRequestBlocksDeneb)
3835
if count == 0 {
3936
return nil
4037
}

0 commit comments

Comments
 (0)