From b251e31fdc6ad626fb29ccac5f3043efe617fd4a Mon Sep 17 00:00:00 2001 From: Andrew Ashikhmin <34320705+yperbasis@users.noreply.github.com> Date: Fri, 6 Jan 2023 17:33:30 +0100 Subject: [PATCH] (*PrefetchedBlocks) Pop -> Get (#6519) After PR #6515 `(*PrefetchedBlocks) Pop` doesn't remove the block from the LRU cache anymore, so `Get` is a better name. --- turbo/stages/bodydownload/body_algos.go | 2 +- turbo/stages/bodydownload/prefetched_blocks.go | 3 +-- 2 files changed, 2 insertions(+), 3 deletions(-) diff --git a/turbo/stages/bodydownload/body_algos.go b/turbo/stages/bodydownload/body_algos.go index 2757c2532..1bf0694f4 100644 --- a/turbo/stages/bodydownload/body_algos.go +++ b/turbo/stages/bodydownload/body_algos.go @@ -210,7 +210,7 @@ func (bd *BodyDownload) RequestMoreBodies(tx kv.RwTx, blockReader services.FullB // checks if we have the block prefetched, returns true if found and stored or false if not present func (bd *BodyDownload) checkPrefetchedBlock(hash common.Hash, tx kv.RwTx, blockNum uint64, blockPropagator adapter.BlockPropagator) bool { - header, body := bd.prefetchedBlocks.Pop(hash) + header, body := bd.prefetchedBlocks.Get(hash) if body == nil { return false diff --git a/turbo/stages/bodydownload/prefetched_blocks.go b/turbo/stages/bodydownload/prefetched_blocks.go index 9f4fc7a44..18a603963 100644 --- a/turbo/stages/bodydownload/prefetched_blocks.go +++ b/turbo/stages/bodydownload/prefetched_blocks.go @@ -21,9 +21,8 @@ func NewPrefetchedBlocks() *PrefetchedBlocks { return &PrefetchedBlocks{blocks: cache} } -func (pb *PrefetchedBlocks) Pop(hash common.Hash) (*types.Header, *types.RawBody) { +func (pb *PrefetchedBlocks) Get(hash common.Hash) (*types.Header, *types.RawBody) { if val, ok := pb.blocks.Get(hash); ok && val != nil { - //pb.blocks.Remove(hash) if headerAndBody, ok := val.(types.HeaderAndBody); ok { return headerAndBody.Header, headerAndBody.Body }