Skip to content

Commit

Permalink
rethresult & retherror
Browse files Browse the repository at this point in the history
  • Loading branch information
shekhirin committed Sep 21, 2023
1 parent 6199c49 commit 5e6f81d
Showing 1 changed file with 5 additions and 4 deletions.
9 changes: 5 additions & 4 deletions crates/snapshot/src/snapshotter.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

use crate::SnapshotterError;
use reth_db::database::Database;
use reth_interfaces::{RethError, RethResult};
use reth_primitives::{BlockNumber, ChainSpec, TxNumber};
use reth_provider::{BlockReader, ProviderFactory};
use std::{ops::RangeInclusive, sync::Arc};
Expand Down Expand Up @@ -96,7 +97,7 @@ impl<DB: Database> Snapshotter<DB> {
pub fn get_snapshot_targets(
&self,
finalized_block_number: BlockNumber,
) -> reth_interfaces::Result<SnapshotTargets> {
) -> RethResult<SnapshotTargets> {
let provider = self.provider_factory.provider()?;

// Round down `finalized_block_number` to a multiple of `block_interval`
Expand All @@ -107,7 +108,7 @@ impl<DB: Database> Snapshotter<DB> {

let to_tx_number = provider
.block_body_indices(to_block_number)?
.ok_or(reth_interfaces::Error::Custom(
.ok_or(RethError::Custom(
"Block body indices for current block number not found".to_string(),
))?
.last_tx_num();
Expand All @@ -128,7 +129,7 @@ impl<DB: Database> Snapshotter<DB> {
if let Some(previous_block_number) = self.highest_snapshots.receipts {
provider
.block_body_indices(previous_block_number)?
.ok_or(reth_interfaces::Error::Custom(
.ok_or(RethError::Custom(
"Block body indices for previous block number not found".to_string(),
))?
.next_tx_num()
Expand All @@ -143,7 +144,7 @@ impl<DB: Database> Snapshotter<DB> {
} else if let Some(previous_block_number) = self.highest_snapshots.transactions {
provider
.block_body_indices(previous_block_number)?
.ok_or(reth_interfaces::Error::Custom(
.ok_or(RethError::Custom(
"Block body indices for previous block number not found".to_string(),
))?
.next_tx_num()
Expand Down

0 comments on commit 5e6f81d

Please sign in to comment.