Skip to content

Commit

Permalink
if block is not found in memory return database.header_td_by_number
Browse files Browse the repository at this point in the history
  • Loading branch information
fgimenez committed Oct 1, 2024
1 parent eaf1409 commit 36b11f7
Showing 1 changed file with 2 additions and 6 deletions.
8 changes: 2 additions & 6 deletions crates/storage/provider/src/providers/blockchain_provider.rs
Original file line number Diff line number Diff line change
Expand Up @@ -373,13 +373,9 @@ impl<N: ProviderNodeTypes> HeaderProvider for BlockchainProvider2<N> {
.get_finalized_num_hash()
.unwrap_or_else(|| BlockNumHash::new(0, B256::default()));
self.database.header_td_by_number(last_finalized_num_hash.number)
} else if let Some(td) = self.database.header_td_by_number(number)? {
// Otherwise, if the TD is recorded on disk, we can just return that
Ok(Some(td))
} else {
// If the block does not exist in memory, and does not exist on-disk, we should not
// return a TD for it.
Ok(None)
// Otherwise, return what we have on disk
self.database.header_td_by_number(number)
}
}

Expand Down

0 comments on commit 36b11f7

Please sign in to comment.