Skip to content

Commit

Permalink
refactor(storage): small refactor in convert_block_number (#10364)
Browse files Browse the repository at this point in the history
  • Loading branch information
tcoratger authored Aug 16, 2024
1 parent fac41d3 commit 6ace2fb
Showing 1 changed file with 6 additions and 8 deletions.
14 changes: 6 additions & 8 deletions crates/storage/storage-api/src/block_id.rs
Original file line number Diff line number Diff line change
Expand Up @@ -62,14 +62,12 @@ pub trait BlockIdReader: BlockNumReader + Send + Sync {
.map(|res_opt| res_opt.map(|num_hash| num_hash.number))
}
BlockNumberOrTag::Number(num) => num,
BlockNumberOrTag::Finalized => match self.finalized_block_number()? {
Some(block_number) => block_number,
None => return Err(ProviderError::FinalizedBlockNotFound),
},
BlockNumberOrTag::Safe => match self.safe_block_number()? {
Some(block_number) => block_number,
None => return Err(ProviderError::SafeBlockNotFound),
},
BlockNumberOrTag::Finalized => {
self.finalized_block_number()?.ok_or(ProviderError::FinalizedBlockNotFound)?
}
BlockNumberOrTag::Safe => {
self.safe_block_number()?.ok_or(ProviderError::SafeBlockNotFound)?
}
};
Ok(Some(num))
}
Expand Down

0 comments on commit 6ace2fb

Please sign in to comment.