mirror of
https://github.com/paradigmxyz/reth.git
synced 2026-04-30 03:01:58 -04:00
chore: reuse raw transaction by hash for debug_getRawTransaction (#6845)
This commit is contained in:
@@ -21,8 +21,10 @@ pub trait DebugApi {
|
||||
async fn raw_block(&self, block_id: BlockId) -> RpcResult<Bytes>;
|
||||
|
||||
/// Returns a EIP-2718 binary-encoded transaction.
|
||||
///
|
||||
/// If this is a pooled EIP-4844 transaction, the blob sidecar is included.
|
||||
#[method(name = "getRawTransaction")]
|
||||
async fn raw_transaction(&self, hash: B256) -> RpcResult<Bytes>;
|
||||
async fn raw_transaction(&self, hash: B256) -> RpcResult<Option<Bytes>>;
|
||||
|
||||
/// Returns an array of EIP-2718 binary-encoded transactions for the given [BlockId].
|
||||
#[method(name = "getRawTransactions")]
|
||||
|
||||
@@ -5,7 +5,7 @@ use crate::{
|
||||
inspect, inspect_and_return_db, prepare_call_env, replay_transactions_until, transact,
|
||||
EvmOverrides,
|
||||
},
|
||||
EthTransactions, TransactionSource,
|
||||
EthTransactions,
|
||||
},
|
||||
result::{internal_rpc_err, ToRpcResult},
|
||||
BlockingTaskGuard, EthApiSpec,
|
||||
@@ -635,13 +635,12 @@ where
|
||||
}
|
||||
|
||||
/// Handler for `debug_getRawTransaction`
|
||||
///
|
||||
/// If this is a pooled EIP-4844 transaction, the blob sidecar is included.
|
||||
///
|
||||
/// Returns the bytes of the transaction for the given hash.
|
||||
async fn raw_transaction(&self, hash: B256) -> RpcResult<Bytes> {
|
||||
let tx = self.inner.eth_api.transaction_by_hash(hash).await?;
|
||||
Ok(tx
|
||||
.map(TransactionSource::into_recovered)
|
||||
.map(|tx| tx.envelope_encoded())
|
||||
.unwrap_or_default())
|
||||
async fn raw_transaction(&self, hash: B256) -> RpcResult<Option<Bytes>> {
|
||||
Ok(self.inner.eth_api.raw_transaction_by_hash(hash).await?)
|
||||
}
|
||||
|
||||
/// Handler for `debug_getRawTransactions`
|
||||
|
||||
Reference in New Issue
Block a user