2 Commits

Author SHA1 Message Date
92759f04db Merge pull request #84 from hl-archive-node/fix/no-panic
fix: Fix panic when block receipts are called on non-existing blocks
2025-10-05 19:47:22 -04:00
71bb70bca6 fix: Fix panic when block receipts are called on non-existing blocks 2025-10-05 14:54:55 +00:00

View File

@ -32,6 +32,7 @@ use reth_rpc_eth_api::{
helpers::{EthBlocks, EthTransactions, LoadReceipt}, helpers::{EthBlocks, EthTransactions, LoadReceipt},
transaction::ConvertReceiptInput, transaction::ConvertReceiptInput,
}; };
use reth_rpc_eth_types::EthApiError;
use serde::Serialize; use serde::Serialize;
use std::{marker::PhantomData, sync::Arc}; use std::{marker::PhantomData, sync::Arc};
use tokio_stream::{Stream, StreamExt}; use tokio_stream::{Stream, StreamExt};
@ -654,6 +655,9 @@ where
block_id: BlockId, block_id: BlockId,
) -> RpcResult<Option<Vec<RpcReceipt<Eth::NetworkTypes>>>> { ) -> RpcResult<Option<Vec<RpcReceipt<Eth::NetworkTypes>>>> {
trace!(target: "rpc::eth", ?block_id, "Serving eth_getBlockReceipts"); trace!(target: "rpc::eth", ?block_id, "Serving eth_getBlockReceipts");
if self.eth_api.provider().block_by_id(block_id).map_err(EthApiError::from)?.is_none() {
return Ok(None);
}
let result = let result =
adjust_block_receipts(block_id, &*self.eth_api).instrument(engine_span!()).await?; adjust_block_receipts(block_id, &*self.eth_api).instrument(engine_span!()).await?;
Ok(result.map(|(_, receipts)| receipts)) Ok(result.map(|(_, receipts)| receipts))