This commit is contained in:
Nicholas Wehr
2025-08-22 00:00:23 -07:00
parent fae4b4c8f9
commit 5c3828382c
2 changed files with 5 additions and 4 deletions

View File

@ -88,9 +88,10 @@ where
let mut bf = backfiller.lock().await; let mut bf = backfiller.lock().await;
if bf.client.max_block < bf.max_block_seen { if bf.client.max_block < bf.max_block_seen {
let block = bf.client.max_block + 1; let block = bf.client.max_block + 1;
let _ = bf.fetch_if_missing(block).await; let new_height = bf.fetch_if_missing(block).await.expect("new height");
bf.client.max_block = new_height.unwrap();
} }
sleep(Duration::from_secs(1)).await; sleep(Duration::from_millis(50)).await;
} }
} }
}); });

View File

@ -330,7 +330,7 @@ impl Backfiller {
pub async fn fetch_if_missing( pub async fn fetch_if_missing(
&mut self, &mut self,
number: u64, number: u64,
) -> Result<Option<usize>, HlfsError> { ) -> Result<Option<u64>, HlfsError> {
let rr_index = number as usize; let rr_index = number as usize;
let n = number.saturating_sub(1); // 0 -> 0, others -> number-1 let n = number.saturating_sub(1); // 0 -> 0, others -> number-1
let f = (n / 1_000_000) * 1_000_000; let f = (n / 1_000_000) * 1_000_000;
@ -357,7 +357,7 @@ impl Backfiller {
return Ok(None); return Ok(None);
} }
debug!(block = number, "hlfs: got block"); debug!(block = number, "hlfs: got block");
Ok(Some(data.len())) Ok(Some(number))
} }
} }
} }