From 71bb70bca68dcbb147a0d2d6883142b2b66915a8 Mon Sep 17 00:00:00 2001 From: sprites0 <199826320+sprites0@users.noreply.github.com> Date: Sun, 5 Oct 2025 14:54:55 +0000 Subject: [PATCH] fix: Fix panic when block receipts are called on non-existing blocks --- src/addons/hl_node_compliance.rs | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/addons/hl_node_compliance.rs b/src/addons/hl_node_compliance.rs index 0c2f68142..0331926bd 100644 --- a/src/addons/hl_node_compliance.rs +++ b/src/addons/hl_node_compliance.rs @@ -32,6 +32,7 @@ use reth_rpc_eth_api::{ helpers::{EthBlocks, EthTransactions, LoadReceipt}, transaction::ConvertReceiptInput, }; +use reth_rpc_eth_types::EthApiError; use serde::Serialize; use std::{marker::PhantomData, sync::Arc}; use tokio_stream::{Stream, StreamExt}; @@ -654,6 +655,9 @@ where block_id: BlockId, ) -> RpcResult>>> { 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 = adjust_block_receipts(block_id, &*self.eth_api).instrument(engine_span!()).await?; Ok(result.map(|(_, receipts)| receipts))