Skip to content

Commit 0a752d7

Browse files
authored
perf: fetch total difficulty by block number (paradigmxyz#3284)
1 parent c328c82 commit 0a752d7

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

crates/rpc/rpc/src/eth/api/block.rs

+4-2
Original file line numberDiff line numberDiff line change
@@ -102,8 +102,10 @@ where
102102
None => return Ok(None),
103103
};
104104
let block_hash = block.hash;
105-
let total_difficulty =
106-
self.provider().header_td(&block_hash)?.ok_or(EthApiError::UnknownBlockNumber)?;
105+
let total_difficulty = self
106+
.provider()
107+
.header_td_by_number(block.number)?
108+
.ok_or(EthApiError::UnknownBlockNumber)?;
107109
let block =
108110
Block::from_block(block.into(), total_difficulty, full.into(), Some(block_hash))?;
109111
Ok(Some(block.into()))

0 commit comments

Comments
 (0)