Skip to content

Commit

Permalink
fmt
Browse files Browse the repository at this point in the history
  • Loading branch information
Larkooo committed Jan 13, 2025
1 parent fe36a2e commit 78b4802
Showing 1 changed file with 4 additions and 8 deletions.
12 changes: 4 additions & 8 deletions crates/torii/indexer/src/engine.rs
Original file line number Diff line number Diff line change
Expand Up @@ -384,10 +384,7 @@ impl<P: Provider + Send + Sync + std::fmt::Debug + 'static> Engine<P> {
let blocks_to_process = total_remaining.min(self.config.blocks_chunk_size);
let to = from + blocks_to_process;

ranges.insert(
*contract_address,
ContractRange { from, to },
);
ranges.insert(*contract_address, ContractRange { from, to });
}
}

Expand All @@ -408,10 +405,9 @@ impl<P: Provider + Send + Sync + std::fmt::Debug + 'static> Engine<P> {
};

// Only fetch 1 event to find the first event block
let events_page =
self.provider.get_events(events_filter, None, 1).await?;
let events_page = self.provider.get_events(events_filter, None, 1).await?;

Ok(events_page.events.first().and_then(|e| e.block_number.map(|b| std::cmp::max(b-1, 0))))
Ok(events_page.events.first().and_then(|e| e.block_number.map(|b| std::cmp::max(b - 1, 0))))
}

async fn fetch_range(
Expand Down Expand Up @@ -579,7 +575,7 @@ impl<P: Provider + Send + Sync + std::fmt::Debug + 'static> Engine<P> {
// Process all transactions
let mut processed_blocks = HashSet::new();
let mut cursor_map = HashMap::new();

for ((block_number, transaction_hash), events) in data.transactions {
debug!("Processing transaction hash: {:#x}", transaction_hash);
// Process transaction
Expand Down

0 comments on commit 78b4802

Please sign in to comment.