(*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.
This commit is contained in:
Andrew Ashikhmin 2023-01-06 17:33:30 +01:00 committed by GitHub
parent 4f536abe46
commit b251e31fdc
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 2 additions and 3 deletions

View File

@ -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

View File

@ -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
}