mirror of
https://gitlab.com/pulsechaincom/erigon-pulse.git
synced 2025-01-03 09:37:38 +00:00
(*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:
parent
4f536abe46
commit
b251e31fdc
@ -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
|
||||
|
@ -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
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user