From eedf61a035b37477ce4b23d36b1a36dff5bac40d Mon Sep 17 00:00:00 2001 From: i1i1 Date: Wed, 25 Dec 2024 12:12:47 +0300 Subject: [PATCH] Apply nits --- bins/fetch/src/main.rs | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/bins/fetch/src/main.rs b/bins/fetch/src/main.rs index de81abae..8a285574 100644 --- a/bins/fetch/src/main.rs +++ b/bins/fetch/src/main.rs @@ -72,6 +72,7 @@ async fn main() -> Result<(), Box> { serde_json::to_writer(block_file, &block) .map_err(|err| format!("Failed to write block to file: {err}"))?; + // Populate bytecodes and state from RPC storage. // TODO: Deduplicate logic with [for_each_block_from_disk] when there is more usage let mut bytecodes: BTreeMap = match File::open("data/bytecodes.bincode.gz") { Ok(compressed_file) => { @@ -82,7 +83,6 @@ async fn main() -> Result<(), Box> { }; bytecodes.extend(storage.get_cache_bytecodes()); - // Populate bytecodes and state from RPC storage. let mut state = BTreeMap::::new(); for (address, mut account) in storage.get_cache_accounts() { if let Some(code) = account.code.take() { @@ -110,11 +110,10 @@ async fn main() -> Result<(), Box> { // TODO: Deduplicate logic with [for_each_block_from_disk] when there is more usage let mut block_hashes = match File::open("data/block_hashes.bincode") { - Ok(compressed_file) => bincode::deserialize_from(compressed_file) - .map_err(|err| format!("Failed to deserialize bytecodes from file: {err}"))?, - Err(_) => BTreeMap::::new(), + Ok(compressed_file) => bincode::deserialize_from::<_, BTreeMap>(compressed_file) + .map_err(|err| format!("Failed to deserialize block hashes from file: {err}"))?, + Err(_) => BTreeMap::new(), }; - block_hashes.extend(storage.get_cache_block_hashes()); if !block_hashes.is_empty() {