diff --git a/zebrad/src/components/mempool/crawler.rs b/zebrad/src/components/mempool/crawler.rs index e924d6382df..f9df921bd28 100644 --- a/zebrad/src/components/mempool/crawler.rs +++ b/zebrad/src/components/mempool/crawler.rs @@ -53,18 +53,12 @@ where /// Periodically crawl peers for transactions to include in the mempool. pub async fn run(self) -> Result<(), BoxError> { - loop { - self.wait_until_enabled().await; + while self.status.wait_until_close_to_tip().await.is_ok() { self.crawl_transactions().await?; sleep(RATE_LIMIT_DELAY).await; } } - /// Wait until the mempool is enabled. - async fn wait_until_enabled(&self) { - // TODO: Check if synchronizing up to chain tip has finished (#2603). - } - /// Crawl peers for transactions. /// /// Concurrently request [`FANOUT`] peers for transactions to include in the mempool.