Skip to content

Commit

Permalink
using Promise.all
Browse files Browse the repository at this point in the history
  • Loading branch information
benesjan committed Nov 29, 2023
1 parent edf4628 commit da730d9
Showing 1 changed file with 10 additions and 5 deletions.
15 changes: 10 additions & 5 deletions yarn-project/aztec-node/src/aztec-node/server.ts
Original file line number Diff line number Diff line change
Expand Up @@ -400,14 +400,19 @@ export class AztecNodeService implements AztecNode {
if (!index) {
return undefined;
}
const leafData = await committedDb.getLeafData(MerkleTreeId.NULLIFIER_TREE, Number(index));
if (!leafData) {
return undefined;
}
const siblingPath = await committedDb.getSiblingPath<typeof NULLIFIER_TREE_HEIGHT>(

const leafDataPromise = committedDb.getLeafData(MerkleTreeId.NULLIFIER_TREE, Number(index));
const siblingPathPromise = committedDb.getSiblingPath<typeof NULLIFIER_TREE_HEIGHT>(
MerkleTreeId.NULLIFIER_TREE,
BigInt(index),
);

const [leafData, siblingPath] = await Promise.all([leafDataPromise, siblingPathPromise]);

if (!leafData) {
return undefined;
}

return new NullifierMembershipWitness(BigInt(index), leafData, siblingPath);
}

Expand Down

0 comments on commit da730d9

Please sign in to comment.