4747
4848const (
4949 decidedCacheSize = 500
50- missingCacheSize = 500
5150)
5251
5352// VMClient is an implementation of VM that talks over RPC.
@@ -70,7 +69,6 @@ type VMClient struct {
7069 blks map [ids.ID ]* BlockClient
7170
7271 decidedBlocks cache.Cacher
73- missingBlocks cache.Cacher
7472
7573 lastAccepted ids.ID
7674}
@@ -103,16 +101,6 @@ func (vm *VMClient) initializeCaches(registerer prometheus.Registerer, namespace
103101 }
104102 vm .decidedBlocks = decidedCache
105103
106- missingCache , err := metercacher .New (
107- fmt .Sprintf ("%s_rpcchainvm_missing_cache" , namespace ),
108- registerer ,
109- & cache.LRU {Size : missingCacheSize },
110- )
111- if err != nil {
112- return fmt .Errorf ("could not initialize missing blocks cache: %w" , err )
113- }
114- vm .missingBlocks = missingCache
115-
116104 return nil
117105}
118106
@@ -301,8 +289,6 @@ func (vm *VMClient) BuildBlock() (snowman.Block, error) {
301289 parentID , err := ids .ToID (resp .ParentID )
302290 vm .ctx .Log .AssertNoError (err )
303291
304- vm .missingBlocks .Evict (id )
305-
306292 return & BlockClient {
307293 vm : vm ,
308294 id : id ,
@@ -331,7 +317,6 @@ func (vm *VMClient) ParseBlock(bytes []byte) (snowman.Block, error) {
331317 if blkIntf , cached := vm .decidedBlocks .Get (id ); cached {
332318 return blkIntf .(* BlockClient ), nil
333319 }
334- vm .missingBlocks .Evict (id )
335320
336321 parentID , err := ids .ToID (resp .ParentID )
337322 vm .ctx .Log .AssertNoError (err )
@@ -363,17 +348,10 @@ func (vm *VMClient) GetBlock(id ids.ID) (snowman.Block, error) {
363348 return blkIntf .(* BlockClient ), nil
364349 }
365350
366- if _ , cached := vm .missingBlocks .Get (id ); cached {
367- return nil , missing .ErrMissingBlock
368- }
369-
370351 resp , err := vm .client .GetBlock (context .Background (), & vmproto.GetBlockRequest {
371352 Id : id [:],
372353 })
373354 if err != nil {
374- if errors .Is (err , missing .ErrMissingBlock ) {
375- vm .missingBlocks .Put (id , struct {}{})
376- }
377355 return nil , err
378356 }
379357
0 commit comments