fix(rpc): propagate provider error for best block number (#22674)

This commit is contained in:
Elaela Solis
2026-03-04 04:13:55 -03:00
committed by GitHub
parent f9f577be0d
commit b73ecdf4c1

View File

@@ -15,7 +15,7 @@ use alloy_dyn_abi::TypedData;
use alloy_eips::{eip2718::Encodable2718, BlockId};
use alloy_network::{TransactionBuilder, TransactionBuilder4844};
use alloy_primitives::{Address, Bytes, TxHash, B256, U256};
use alloy_rpc_types_eth::{BlockNumberOrTag, TransactionInfo};
use alloy_rpc_types_eth::TransactionInfo;
use futures::{Future, StreamExt};
use reth_chain_state::CanonStateSubscriptions;
use reth_primitives_traits::{
@@ -343,9 +343,7 @@ pub trait EthTransactions: LoadTransaction<Provider: BlockReaderIdExt> {
return Ok(None);
}
let Ok(high) = self.provider().best_block_number() else {
return Err(EthApiError::HeaderNotFound(BlockNumberOrTag::Latest.into()).into());
};
let high = self.provider().best_block_number().map_err(Self::Error::from_eth_err)?;
// Perform a binary search over the block range to find the block in which the sender's
// nonce reached the requested nonce.