Skip to content

Commit

Permalink
Merge pull request #63 from chaindexing/fix-events-ingestion-per-chain
Browse files Browse the repository at this point in the history
Fix Ingesting Events Per Chain
  • Loading branch information
Jurshsmith authored Mar 5, 2024
2 parents bf7c343 + eb68192 commit 1636eb7
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 2 deletions.
2 changes: 1 addition & 1 deletion chaindexing/src/contracts.rs
Original file line number Diff line number Diff line change
Expand Up @@ -198,7 +198,7 @@ impl ContractAddressID {
#[diesel(primary_key(id))]
pub struct ContractAddress {
pub id: i32,
chain_id: i64,
pub chain_id: i64,
pub next_block_number_to_ingest_from: i64,
pub next_block_number_to_handle_from: i64,
pub start_block_number: i64,
Expand Down
9 changes: 8 additions & 1 deletion chaindexing/src/events_ingester.rs
Original file line number Diff line number Diff line change
Expand Up @@ -138,8 +138,15 @@ impl EventsIngester {
min_confirmation_count: &MinConfirmationCount,
) -> Result<(), EventsIngesterError> {
let current_block_number = fetch_current_block_number(&json_rpc).await;
let mut contract_addresses_stream =
let contract_addresses_stream =
ChaindexingRepo::get_contract_addresses_stream(conn.clone());
// TODO: Move to Repo Level
let mut contract_addresses_stream = contract_addresses_stream.map(|contract_addresses| {
contract_addresses
.into_iter()
.filter(|ca| ca.chain_id as u64 == *chain as u64)
.collect::<Vec<_>>()
});

while let Some(contract_addresses) = contract_addresses_stream.next().await {
let contract_addresses = Self::filter_uningested_contract_addresses(
Expand Down

0 comments on commit 1636eb7

Please sign in to comment.