mirror of
https://github.com/hl-archive-node/nanoreth.git
synced 2025-12-06 10:59:55 +00:00
chore: make clippy happy (#11408)
This commit is contained in:
@ -582,7 +582,7 @@ impl<N: ProviderNodeTypes> BlockReader for BlockchainProvider2<N> {
|
||||
let mut stored_indices = self
|
||||
.database
|
||||
.block_body_indices(anchor_num)?
|
||||
.ok_or_else(|| ProviderError::BlockBodyIndicesNotFound(anchor_num))?;
|
||||
.ok_or(ProviderError::BlockBodyIndicesNotFound(anchor_num))?;
|
||||
stored_indices.first_tx_num = stored_indices.next_tx_num();
|
||||
|
||||
for state in parent_chain {
|
||||
|
||||
@ -630,7 +630,7 @@ impl<TX: DbTx, Spec: Send + Sync> DatabaseProvider<TX, Spec> {
|
||||
// recover the sender from the transaction if not found
|
||||
let sender = tx
|
||||
.recover_signer_unchecked()
|
||||
.ok_or_else(|| ProviderError::SenderRecoveryError)?;
|
||||
.ok_or(ProviderError::SenderRecoveryError)?;
|
||||
senders.push(sender);
|
||||
}
|
||||
Some(sender) => senders.push(*sender),
|
||||
|
||||
@ -120,7 +120,7 @@ impl<N: ProviderNodeTypes> BlockchainProvider<N> {
|
||||
let best: ChainInfo = provider.chain_info()?;
|
||||
let latest_header = provider
|
||||
.header_by_number(best.best_number)?
|
||||
.ok_or(ProviderError::HeaderNotFound(best.best_number.into()))?;
|
||||
.ok_or_else(|| ProviderError::HeaderNotFound(best.best_number.into()))?;
|
||||
|
||||
let finalized_header = provider
|
||||
.last_finalized_block_number()?
|
||||
|
||||
@ -285,7 +285,9 @@ impl StaticFileProvider {
|
||||
let fixed_block_range = self.find_fixed_range(block_range.start());
|
||||
let jar_provider = self
|
||||
.get_segment_provider(segment, || Some(fixed_block_range), None)?
|
||||
.ok_or(ProviderError::MissingStaticFileBlock(segment, block_range.start()))?;
|
||||
.ok_or_else(|| {
|
||||
ProviderError::MissingStaticFileBlock(segment, block_range.start())
|
||||
})?;
|
||||
|
||||
entries += jar_provider.rows();
|
||||
|
||||
@ -323,7 +325,7 @@ impl StaticFileProvider {
|
||||
|| self.get_segment_ranges_from_block(segment, block),
|
||||
path,
|
||||
)?
|
||||
.ok_or_else(|| ProviderError::MissingStaticFileBlock(segment, block))
|
||||
.ok_or(ProviderError::MissingStaticFileBlock(segment, block))
|
||||
}
|
||||
|
||||
/// Gets the [`StaticFileJarProvider`] of the requested segment and transaction.
|
||||
@ -338,7 +340,7 @@ impl StaticFileProvider {
|
||||
|| self.get_segment_ranges_from_transaction(segment, tx),
|
||||
path,
|
||||
)?
|
||||
.ok_or_else(|| ProviderError::MissingStaticFileTx(segment, tx))
|
||||
.ok_or(ProviderError::MissingStaticFileTx(segment, tx))
|
||||
}
|
||||
|
||||
/// Gets the [`StaticFileJarProvider`] of the requested segment and block or transaction.
|
||||
|
||||
@ -413,7 +413,7 @@ where
|
||||
|
||||
let mut tx_index = first_tx_index
|
||||
.or(last_tx_idx)
|
||||
.ok_or_else(|| ProviderError::BlockBodyIndicesNotFound(block_number))?;
|
||||
.ok_or(ProviderError::BlockBodyIndicesNotFound(block_number))?;
|
||||
|
||||
for tx in transactions.borrow() {
|
||||
self.static_file_mut().append_transaction(tx_index, tx)?;
|
||||
@ -483,7 +483,7 @@ where
|
||||
|
||||
let first_tx_index = first_tx_index
|
||||
.or(last_tx_idx)
|
||||
.ok_or_else(|| ProviderError::BlockBodyIndicesNotFound(block_number))?;
|
||||
.ok_or(ProviderError::BlockBodyIndicesNotFound(block_number))?;
|
||||
|
||||
// update for empty blocks
|
||||
last_tx_idx = Some(first_tx_index);
|
||||
|
||||
@ -89,12 +89,12 @@ pub trait TransactionsProviderExt: BlockReader + Send + Sync {
|
||||
) -> ProviderResult<RangeInclusive<TxNumber>> {
|
||||
let from = self
|
||||
.block_body_indices(*block_range.start())?
|
||||
.ok_or(ProviderError::BlockBodyIndicesNotFound(*block_range.start()))?
|
||||
.ok_or_else(|| ProviderError::BlockBodyIndicesNotFound(*block_range.start()))?
|
||||
.first_tx_num();
|
||||
|
||||
let to = self
|
||||
.block_body_indices(*block_range.end())?
|
||||
.ok_or(ProviderError::BlockBodyIndicesNotFound(*block_range.end()))?
|
||||
.ok_or_else(|| ProviderError::BlockBodyIndicesNotFound(*block_range.end()))?
|
||||
.last_tx_num();
|
||||
|
||||
Ok(from..=to)
|
||||
|
||||
Reference in New Issue
Block a user