From 6b28fa4300593235de87dc3f752f019953032007 Mon Sep 17 00:00:00 2001 From: Matthias Seitz Date: Wed, 20 Mar 2024 16:58:00 +0100 Subject: [PATCH] fix: skip block tracing if empty (#7251) --- crates/rpc/rpc/src/debug.rs | 5 +++++ crates/rpc/rpc/src/eth/api/transactions.rs | 5 +++++ 2 files changed, 10 insertions(+) diff --git a/crates/rpc/rpc/src/debug.rs b/crates/rpc/rpc/src/debug.rs index a8d4459350..15f0d8a1db 100644 --- a/crates/rpc/rpc/src/debug.rs +++ b/crates/rpc/rpc/src/debug.rs @@ -79,6 +79,11 @@ where block_env: BlockEnv, opts: GethDebugTracingOptions, ) -> EthResult> { + if transactions.is_empty() { + // nothing to trace + return Ok(Vec::new()); + } + // replay all transactions of the block let this = self.clone(); self.inner diff --git a/crates/rpc/rpc/src/eth/api/transactions.rs b/crates/rpc/rpc/src/eth/api/transactions.rs index f375f72bac..207de3017a 100644 --- a/crates/rpc/rpc/src/eth/api/transactions.rs +++ b/crates/rpc/rpc/src/eth/api/transactions.rs @@ -1058,6 +1058,11 @@ where let Some(block) = block else { return Ok(None) }; + if block.body.is_empty() { + // nothing to trace + return Ok(Some(Vec::new())); + } + // replay all transactions of the block self.spawn_tracing_task_with(move |this| { // we need to get the state of the parent block because we're replaying this block on