perf(provider): remove redundant lookup (#1650)

This commit is contained in:
Roman Krasiuk
2023-03-06 23:18:51 +02:00
committed by GitHub
parent 3503444342
commit 32e31b240d

View File

@@ -62,11 +62,7 @@ impl<DB: Database> HeaderProvider for ShareableDatabase<DB> {
}
fn header_by_number(&self, num: BlockNumber) -> Result<Option<Header>> {
if let Some(hash) = self.db.view(|tx| tx.get::<tables::CanonicalHeaders>(num))?? {
self.header(&hash)
} else {
Ok(None)
}
Ok(self.db.view(|tx| tx.get::<tables::Headers>(num))??)
}
fn header_td(&self, hash: &BlockHash) -> Result<Option<U256>> {