async fn l2_block_hashes_match(&self, l2_block: L2BlockNumber) -> Result<bool, HashMatchError> {
        let mut storage = self.pool.connection().await?;
        let local_hash = storage
            .blocks_dal()
            .get_l2_block_header(l2_block)
            .await?
            .with_context(|| format!("Header does not exist for local L2 block #{l2_block}"))?
            .hash;
        drop(storage);

        let Some(remote_hash) = self.client.l2_block_hash(l2_block).await? else {
            // Due to reorg, locally we may be ahead of the main node.
            // Lack of the hash on the main node is treated as a hash match,
            // We need to wait for our knowledge of main node to catch up.
            tracing::info!("Remote L2 block #{l2_block} is missing");
            return Err(MissingData::L2Block.into());
        };

        if remote_hash != local_hash {
            tracing::warn!(
                "Reorg detected: local hash {local_hash:?} doesn't match the hash from \
                main node {remote_hash:?} (L2 block #{l2_block})"
            );
        }
        Ok(remote_hash == local_hash)
    }
Compares hashes of the given local L2 block and the same L2 block from main node.
core/node/reorg_detector/src/lib.rs