pub async fn wait_for_initialized_storage(
        &self,
        stop_receiver: watch::Receiver<bool>,
    ) -> Result<(), OrStopped> {
        const POLLING_INTERVAL: Duration = Duration::from_secs(1);

        // Wait until data is added to the database.
        poll(stop_receiver.clone(), POLLING_INTERVAL, || {
            self.is_database_initialized()
        })
        .await?;

        // Wait until the rollback is no longer needed.
        poll(stop_receiver.clone(), POLLING_INTERVAL, || {
            self.is_chain_tip_correct(stop_receiver.clone())
        })
        .await
    }
Checks if the node can safely start operating.
core/node/node_storage_init/src/lib.rs