mirror of
https://github.com/hl-archive-node/nanoreth.git
synced 2025-12-06 10:59:55 +00:00
fix(provider): fix pending block retrieval in find_block_by_hash (#14303)
This commit is contained in:
@ -797,22 +797,21 @@ impl<N: ProviderNodeTypes> BlockReader for ConsistentProvider<N> {
|
||||
source: BlockSource,
|
||||
) -> ProviderResult<Option<Self::Block>> {
|
||||
if matches!(source, BlockSource::Canonical | BlockSource::Any) {
|
||||
return self.get_in_memory_or_storage_by_block(
|
||||
if let Some(block) = self.get_in_memory_or_storage_by_block(
|
||||
hash.into(),
|
||||
|db_provider| db_provider.find_block_by_hash(hash, BlockSource::Canonical),
|
||||
|block_state| Ok(Some(block_state.block_ref().recovered_block().clone_block())),
|
||||
)
|
||||
)? {
|
||||
return Ok(Some(block))
|
||||
}
|
||||
}
|
||||
|
||||
if matches!(source, BlockSource::Pending | BlockSource::Any) {
|
||||
if let Some(block) = self
|
||||
return Ok(self
|
||||
.canonical_in_memory_state
|
||||
.pending_block()
|
||||
.filter(|b| b.hash() == hash)
|
||||
.map(|b| b.into_block())
|
||||
{
|
||||
return Ok(Some(block))
|
||||
}
|
||||
.map(|b| b.into_block()))
|
||||
}
|
||||
|
||||
Ok(None)
|
||||
|
||||
Reference in New Issue
Block a user