diff --git a/chain/client/tests/process_blocks.rs b/chain/client/tests/process_blocks.rs index fa9283b2ed0..175feee19d7 100644 --- a/chain/client/tests/process_blocks.rs +++ b/chain/client/tests/process_blocks.rs @@ -1751,7 +1751,8 @@ fn test_data_reset_before_state_sync() { head_block.header().epoch_id(), &QueryRequest::ViewAccount { account_id: "test_account".to_string() }, ); - assert!(response.is_err()); + // TODO(#3742): ViewClient still has data in cache by current design. + assert!(response.is_ok()); } #[test] diff --git a/core/store/src/trie/shard_tries.rs b/core/store/src/trie/shard_tries.rs index 8306285c3ea..50d51634114 100644 --- a/core/store/src/trie/shard_tries.rs +++ b/core/store/src/trie/shard_tries.rs @@ -82,8 +82,7 @@ impl ShardTries { } } for (shard_id, ops) in shards.into_iter().enumerate() { - self.caches[shard_id].update_cache(&ops); - self.view_caches[shard_id].update_cache(&ops); + self.caches[shard_id].update_cache(ops); } Ok(()) } diff --git a/core/store/src/trie/trie_storage.rs b/core/store/src/trie/trie_storage.rs index 5c0d3f86c41..2abbbbd7e60 100644 --- a/core/store/src/trie/trie_storage.rs +++ b/core/store/src/trie/trie_storage.rs @@ -21,13 +21,13 @@ impl TrieCache { Self(Arc::new(Mutex::new(SizedCache::with_size(TRIE_MAX_CACHE_SIZE)))) } - pub fn update_cache(&self, ops: &[(CryptoHash, Option>)]) { + pub fn update_cache(&self, ops: Vec<(CryptoHash, Option>)>) { let mut guard = self.0.lock().expect(POISONED_LOCK_ERR); for (hash, opt_value_rc) in ops { if let Some(value_rc) = opt_value_rc { - if let (Some(value), _rc) = decode_value_with_rc(value_rc) { + if let (Some(value), _rc) = decode_value_with_rc(&value_rc) { if value.len() < TRIE_LIMIT_CACHED_VALUE_SIZE { - guard.cache_set(*hash, value.to_vec()); + guard.cache_set(hash, value.to_vec()); } } else { guard.cache_remove(&hash);