Skip to content
This repository has been archived by the owner on Oct 25, 2024. It is now read-only.

Commit

Permalink
adjust last_block_height_for_indexer
Browse files Browse the repository at this point in the history
  • Loading branch information
lostman committed Sep 15, 2023
1 parent 2763f12 commit 4f02ed5
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions packages/fuel-indexer-database/postgres/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -633,7 +633,8 @@ pub async fn indexer_assets(
})
}

/// Return the last block height that the given indexer has indexed.
/// Return the last block height that the given indexer has indexed. If the
/// indexer indexed no blocks, the result is 0.
#[cfg_attr(feature = "metrics", metrics)]
pub async fn last_block_height_for_indexer(
conn: &mut PoolConnection<Postgres>,
Expand All @@ -649,7 +650,7 @@ pub async fn last_block_height_for_indexer(
Ok(row
.try_get::<i32, usize>(0)
.map(|id| id.to_u32().expect("Bad block height."))
.unwrap_or_else(|_e| 1))
.unwrap_or(0))
}

// TODO: https://github.com/FuelLabs/fuel-indexer/issues/251
Expand Down

0 comments on commit 4f02ed5

Please sign in to comment.