Skip to content
This repository has been archived by the owner on Nov 5, 2023. It is now read-only.

Commit

Permalink
joined future block and receipt fetching
Browse files Browse the repository at this point in the history
  • Loading branch information
refcell committed Nov 3, 2023
1 parent 63cd43d commit 0474763
Showing 1 changed file with 9 additions and 10 deletions.
19 changes: 9 additions & 10 deletions crates/rpc/rpc/src/eth/api/transactions.rs
Original file line number Diff line number Diff line change
Expand Up @@ -890,15 +890,14 @@ where
meta: TransactionMeta,
receipt: Receipt,
) -> EthResult<TransactionReceipt> {
// get all receipts for the block
let all_receipts = match self.cache().get_receipts(meta.block_hash).await? {
Some(recpts) => recpts,
None => return Err(EthApiError::UnknownBlockNumber),
};
let block = self
.provider()
.block_by_number(meta.block_number)?
.ok_or(EthApiError::UnknownBlockNumber)?;
let receipt_fut = self.cache().get_receipts(meta.block_hash);
let block_fut = self.cache().get_block(meta.block_hash);

let (receipts, block) = futures::try_join!(receipt_fut, block_fut)?;
let (receipts, block) = (
receipts.ok_or(EthApiError::InternalEthError)?,
block.ok_or(EthApiError::InternalEthError)?,
);

let l1_block_info = reth_revm::optimism::extract_l1_info(&block).ok();
let optimism_tx_meta = self.build_op_tx_meta(&tx, l1_block_info, block.timestamp)?;
Expand All @@ -907,7 +906,7 @@ where
tx,
meta,
receipt,
&all_receipts,
&receipts,
optimism_tx_meta,
)
}
Expand Down

0 comments on commit 0474763

Please sign in to comment.