diff --git a/crates/rpc/rpc/src/debug.rs b/crates/rpc/rpc/src/debug.rs index 9dd083c90..6c79e4ed2 100644 --- a/crates/rpc/rpc/src/debug.rs +++ b/crates/rpc/rpc/src/debug.rs @@ -897,13 +897,10 @@ where /// Returns the bytes of the transaction for the given hash. async fn raw_transaction(&self, hash: B256) -> RpcResult { let tx = self.inner.eth_api.transaction_by_hash(hash).await?; - - let mut res = Vec::new(); - if let Some(tx) = tx.map(TransactionSource::into_recovered) { - tx.encode(&mut res); - } - - Ok(res.into()) + Ok(tx + .map(TransactionSource::into_recovered) + .map(|tx| tx.envelope_encoded()) + .unwrap_or_default()) } /// Handler for `debug_getRawReceipts`