From 32e31b240dbfe9c98f6f7bfba9f76b878a3dc728 Mon Sep 17 00:00:00 2001 From: Roman Krasiuk Date: Mon, 6 Mar 2023 23:18:51 +0200 Subject: [PATCH] perf(provider): remove redundant lookup (#1650) --- crates/storage/provider/src/providers/mod.rs | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/crates/storage/provider/src/providers/mod.rs b/crates/storage/provider/src/providers/mod.rs index 8ea781b06f..19801249ef 100644 --- a/crates/storage/provider/src/providers/mod.rs +++ b/crates/storage/provider/src/providers/mod.rs @@ -62,11 +62,7 @@ impl HeaderProvider for ShareableDatabase { } fn header_by_number(&self, num: BlockNumber) -> Result> { - if let Some(hash) = self.db.view(|tx| tx.get::(num))?? { - self.header(&hash) - } else { - Ok(None) - } + Ok(self.db.view(|tx| tx.get::(num))??) } fn header_td(&self, hash: &BlockHash) -> Result> {