Skip to content

Commit

Permalink
fix
Browse files Browse the repository at this point in the history
  • Loading branch information
klkvr committed Dec 3, 2024
1 parent ead3c96 commit d45d3bc
Showing 1 changed file with 20 additions and 22 deletions.
42 changes: 20 additions & 22 deletions crates/rpc/rpc-eth-api/src/helpers/pending_block.rs
Original file line number Diff line number Diff line change
Expand Up @@ -70,31 +70,29 @@ pub trait LoadPendingBlock:
///
/// If no pending block is available, this will derive it from the `latest` block
fn pending_block_env_and_cfg(&self) -> Result<PendingBlockEnv, Self::Error> {
let maybe_actual_pending = {
if let Some(pending) =
self.provider().pending_block_with_senders().map_err(Self::Error::from_eth_err)?
if let Some(block) =
self.provider().pending_block_with_senders().map_err(Self::Error::from_eth_err)?
{
if let Some(receipts) = self
.provider()
.receipts_by_block(block.hash().into())
.map_err(Self::Error::from_eth_err)?
{
if let Some(receipts) = self
// Note: for the PENDING block we assume it is past the known merge block and
// thus this will not fail when looking up the total
// difficulty value for the blockenv.
let (cfg, block_env) = self
.provider()
.receipts_by_block(pending.hash().into())
.map_err(Self::Error::from_eth_err)?
{
// Note: for the PENDING block we assume it is past the known merge block and
// thus this will not fail when looking up the total
// difficulty value for the blockenv.
let (cfg, block_env) = self
.provider()
.env_with_header(block.header(), self.evm_config().clone())
.map_err(Self::Error::from_eth_err)?;

return Ok(PendingBlockEnv::new(
cfg,
block_env,
PendingBlockEnvOrigin::ActualPending(block, receipts),
));
}
.env_with_header(block.header(), self.evm_config().clone())
.map_err(Self::Error::from_eth_err)?;

return Ok(PendingBlockEnv::new(
cfg,
block_env,
PendingBlockEnvOrigin::ActualPending(block, receipts),
));
}
};
}

// no pending block from the CL yet, so we use the latest block and modify the env
// values that we can
Expand Down

0 comments on commit d45d3bc

Please sign in to comment.