RPC: don't save nil's to blocksLRU (#2937)

This commit is contained in:
Alex Sharov 2021-11-10 10:31:13 +07:00 committed by GitHub
parent f96a591611
commit c7a014b72f
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

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