chore: clean up some errors (#7585)

This commit is contained in:
Oliver Nordbjerg
2024-04-12 11:59:09 +02:00
committed by GitHub
parent c738087f10
commit 47d533217c
3 changed files with 3 additions and 9 deletions

View File

@ -23,9 +23,6 @@ pub enum ProviderError {
/// Error when recovering the sender for a transaction
#[error("failed to recover sender for transaction")]
SenderRecoveryError,
/// Inconsistent header gap.
#[error("inconsistent header gap in the database")]
InconsistentHeaderGap,
/// The header number was not found for the given block hash.
#[error("block hash {0} does not exist in Headers table")]
BlockHashNotFound(BlockHash),
@ -65,9 +62,6 @@ pub enum ProviderError {
/// The specific receipt is missing
#[error("no receipt found for {0:?}")]
ReceiptNotFound(TxHashOrNumber),
/// Unable to find a specific block.
#[error("block does not exist {0:?}")]
BlockNotFound(BlockHashOrNumber),
/// Unable to find the best block.
#[error("best block does not exist")]
BestBlockNotFound,

View File

@ -476,7 +476,7 @@ where
None => self
.provider
.block_hash(header.number)?
.ok_or(ProviderError::BlockNotFound(header.number.into()))?,
.ok_or(ProviderError::HeaderNotFound(header.number.into()))?,
};
if let Some(receipts) = self.eth_cache.get_receipts(block_hash).await? {

View File

@ -166,7 +166,7 @@ impl<EF: ExecutorFactory> ExecutionStage<EF> {
// we need the block's transactions but we don't need the transaction hashes
let block = provider
.block_with_senders(block_number.into(), TransactionVariant::NoHash)?
.ok_or_else(|| ProviderError::BlockNotFound(block_number.into()))?;
.ok_or_else(|| ProviderError::HeaderNotFound(block_number.into()))?;
fetch_block_duration += fetch_block_start.elapsed();
@ -456,7 +456,7 @@ impl<EF: ExecutorFactory, DB: Database> Stage<DB> for ExecutionStage<EF> {
for block_number in range {
stage_checkpoint.progress.processed -= provider
.block_by_number(block_number)?
.ok_or_else(|| ProviderError::BlockNotFound(block_number.into()))?
.ok_or_else(|| ProviderError::HeaderNotFound(block_number.into()))?
.gas_used;
}
}