fix: eth_callMany pending tag (#7351)

This commit is contained in:
Matthias Seitz
2024-03-27 23:53:27 +01:00
committed by GitHub
parent d6e4eab527
commit 8d488f5982
2 changed files with 5 additions and 7 deletions

View File

@ -99,6 +99,7 @@ where
let transaction_index = transaction_index.unwrap_or_default();
let target_block = block_number.unwrap_or(BlockId::Number(BlockNumberOrTag::Latest));
let is_block_target_pending = target_block.is_pending();
let ((cfg, block_env, _), block) = futures::try_join!(
self.evm_env_at(target_block),
@ -113,9 +114,11 @@ where
let mut at = block.parent_hash;
let mut replay_block_txs = true;
// but if all transactions are to be replayed, we can use the state at the block itself
let num_txs = transaction_index.index().unwrap_or(block.body.len());
if num_txs == block.body.len() {
// but if all transactions are to be replayed, we can use the state at the block itself,
// however only if we're not targeting the pending block, because for pending we can't rely
// on the block's state being available
if !is_block_target_pending && num_txs == block.body.len() {
at = block.hash();
replay_block_txs = false;
}

View File

@ -337,11 +337,6 @@ where
}
}
// if we're currently syncing, we're unable to build a pending block
if this.network().is_syncing() {
return Ok(None)
}
// we rebuild the block
let pending_block = match pending.build_block(this.provider(), this.pool()) {
Ok(block) => block,