From c9af0847c4fe7776ccd3117d2d415583a8b79750 Mon Sep 17 00:00:00 2001 From: Thomas Coratger <60488569+tcoratger@users.noreply.github.com> Date: Mon, 12 Aug 2024 15:35:53 -0700 Subject: [PATCH] rpc: small refactoring in `build_transaction_receipt` (#10269) --- crates/rpc/rpc-eth-api/src/helpers/receipt.rs | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/crates/rpc/rpc-eth-api/src/helpers/receipt.rs b/crates/rpc/rpc-eth-api/src/helpers/receipt.rs index 63016e3d2e..39da504750 100644 --- a/crates/rpc/rpc-eth-api/src/helpers/receipt.rs +++ b/crates/rpc/rpc-eth-api/src/helpers/receipt.rs @@ -26,15 +26,12 @@ pub trait LoadReceipt: EthApiTypes + Send + Sync { ) -> impl Future> + Send { async move { // get all receipts for the block - let all_receipts = match self + let all_receipts = self .cache() .get_receipts(meta.block_hash) .await .map_err(Self::Error::from_eth_err)? - { - Some(recpts) => recpts, - None => return Err(EthApiError::UnknownBlockNumber.into()), - }; + .ok_or_else(|| EthApiError::UnknownBlockNumber)?; Ok(ReceiptBuilder::new(&tx, meta, &receipt, &all_receipts)?.build()) }