Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Explorer integration 1.0 #266

Open
wants to merge 9 commits into
base: explorer-integration
Choose a base branch
from
Prev Previous commit
Next Next commit
minor fix a performance issue of uncessary calling get_leaf_with_proof
  • Loading branch information
xgaozoyoe committed May 28, 2024
commit 5d79d64933bce95be6823510585514dca8f79391
10 changes: 5 additions & 5 deletions crates/host/src/host/merkle_helper/merkle.rs
Original file line number Diff line number Diff line change
@@ -124,14 +124,14 @@ impl MerkleContext {
.mongo_merkle
.as_ref()
.expect("merkle db not initialized");
let (leaf, _) = mt
.get_leaf_with_proof(index)
.expect("Unexpected failure: get leaf fail");
let values = leaf.data_as_u64();
if self.data_cursor == 0 {
let (leaf, _) = mt
.get_leaf_with_proof(index)
.expect("Unexpected failure: get leaf fail");
let values = leaf.data_as_u64();
self.data = values;
}
let v = values[self.data_cursor];
let v = self.data[self.data_cursor];
self.data_cursor += 1;
return v;
}