pub fn with_hasher(mut db: DB, recovered_version: u64, hasher: H) -> anyhow::Result<Self> {
        let manifest = db.manifest();
        let mut manifest = if let Some(manifest) = manifest {
            if manifest.version_count > 0 {
                let expected_version = manifest.version_count - 1;
                anyhow::ensure!(
                    recovered_version == expected_version,
                    "Requested to recover tree version {recovered_version}, but it is currently being recovered \
                    for version {expected_version}"
                );
            }
            manifest
        } else {
            Manifest {
                version_count: recovered_version + 1,
                tags: None,
            }
        };

        manifest.version_count = recovered_version + 1;
        if let Some(tags) = &manifest.tags {
            tags.ensure_consistency(&hasher, true)?;
        } else {
            let mut tags = TreeTags::new(&hasher);
            tags.is_recovering = true;
            manifest.tags = Some(tags);
        }
        db.apply_patch(PatchSet::from_manifest(manifest))?;

        Ok(Self {
            db: MaybeParallel::Sequential(db),
            hasher,
            recovered_version,
        })
    }
Loads a tree with the specified hasher.

# Errors

- Errors if the tree DB exists and it's not being recovered, or if it's being recovered
for a different tree version.
- Errors if the hasher or basic tree parameters (e.g., the tree depth)
do not match those of the tree loaded from the database.
core/lib/merkle_tree/src/recovery/mod.rs