From 4f02ed573c50ee9bbaa0f682bb7d4cea829f842c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Maciej=20Wo=C5=9B?= Date: Fri, 15 Sep 2023 14:42:23 +0200 Subject: [PATCH] adjust last_block_height_for_indexer --- packages/fuel-indexer-database/postgres/src/lib.rs | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/packages/fuel-indexer-database/postgres/src/lib.rs b/packages/fuel-indexer-database/postgres/src/lib.rs index e02701c68..9678f7a13 100644 --- a/packages/fuel-indexer-database/postgres/src/lib.rs +++ b/packages/fuel-indexer-database/postgres/src/lib.rs @@ -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, @@ -649,7 +650,7 @@ pub async fn last_block_height_for_indexer( Ok(row .try_get::(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