From c7a014b72fa6b1972ed94ec7941a0a04bb95503b Mon Sep 17 00:00:00 2001 From: Alex Sharov Date: Wed, 10 Nov 2021 10:31:13 +0700 Subject: [PATCH] RPC: don't save nil's to blocksLRU (#2937) --- cmd/rpcdaemon/commands/eth_api.go | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/cmd/rpcdaemon/commands/eth_api.go b/cmd/rpcdaemon/commands/eth_api.go index 07ecbb824..6647b05e8 100644 --- a/cmd/rpcdaemon/commands/eth_api.go +++ b/cmd/rpcdaemon/commands/eth_api.go @@ -163,7 +163,9 @@ func (api *BaseAPI) blockWithSenders(tx kv.Tx, hash common.Hash, number uint64) if err != nil { return nil, err } - + if block == nil { // don't save nil's to cache + return nil, nil + } if api.blocksLRU != nil { api.blocksLRU.Add(hash, block) }