Skip to content

Commit

Permalink
update get_proof_for to fetch tree by item status
Browse files Browse the repository at this point in the history
  • Loading branch information
0xKitsune committed Oct 26, 2024
1 parent 0f092eb commit 78c48f9
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 2 deletions.
2 changes: 1 addition & 1 deletion src/identity/processor.rs
Original file line number Diff line number Diff line change
Expand Up @@ -259,7 +259,7 @@ impl OnChainIdentityProcessor {
)
.await
.map_err(|e| {
error!(?e, "Failed to insert identity to contract.");
error!(?e, "Failed to insert identity to contract.");
e
})?;

Expand Down
7 changes: 6 additions & 1 deletion src/identity_tree/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -585,7 +585,12 @@ impl TreeState {

#[must_use]
pub fn get_proof_for(&self, item: &TreeItem) -> (Field, InclusionProof) {
let (leaf, root, proof) = self.latest.get_leaf_and_proof(item.leaf_index);
let (leaf, root, proof) = match item.status {
ProcessedStatus::Processed | ProcessedStatus::Mined => {
self.processed.get_leaf_and_proof(item.leaf_index)
}
ProcessedStatus::Pending => self.latest.get_leaf_and_proof(item.leaf_index),
};

let proof = InclusionProof {
root: Some(root),
Expand Down

0 comments on commit 78c48f9

Please sign in to comment.