Skip to content

Commit

Permalink
Merge pull request #821 from worldcoin/piohei/fix_tree_restore
Browse files Browse the repository at this point in the history
Fix restoring tree from cache with mined status back.
  • Loading branch information
piohei authored Nov 12, 2024
2 parents 262c595 + 148a452 commit e823802
Showing 1 changed file with 11 additions and 2 deletions.
13 changes: 11 additions & 2 deletions src/identity_tree/initializer.rs
Original file line number Diff line number Diff line change
Expand Up @@ -165,11 +165,11 @@ impl TreeInitializer {
return Ok(None);
};

let (mined, processed_builder) = mined_builder.seal();
let (mined, mut processed_builder) = mined_builder.seal();

match self
.database
.get_latest_root_by_status(ProcessedStatus::Processed)
.get_latest_root_by_status(ProcessedStatus::Mined)
.await?
{
Some(root) => {
Expand All @@ -184,6 +184,15 @@ impl TreeInitializer {
}
}

let processed_items = self
.database
.get_commitments_by_status(ProcessedStatus::Processed)
.await?;

for processed_item in processed_items {
processed_builder.update(&processed_item);
}

let (processed, batching_builder) = processed_builder.seal_and_continue();
let (batching, mut latest_builder) = batching_builder.seal_and_continue();

Expand Down

0 comments on commit e823802

Please sign in to comment.