Skip to content

Commit

Permalink
fix: executeHashComputations() util to call hasher implementation
Browse files Browse the repository at this point in the history
  • Loading branch information
twoeths committed May 26, 2024
1 parent d3dd65b commit 6d04f86
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion packages/persistent-merkle-tree/src/node.ts
Original file line number Diff line number Diff line change
Expand Up @@ -395,7 +395,6 @@ export function bitwiseOrNodeH(node: Node, hIndex: number, value: number): void
else throw Error("hIndex > 7");
}


export function getHashComputations(node: Node, offset: number, hashCompsByLevel: Array<HashComputation[]>): void {
if (node.h0 === null) {
const hashComputations = arrayAtIndex(hashCompsByLevel, offset);
Expand All @@ -411,6 +410,10 @@ export function getHashComputations(node: Node, offset: number, hashCompsByLevel
// else stop the recursion, LeafNode should have h0
}

export function executeHashComputations(hashComputations: Array<HashComputation[]>): void {
hasher.executeHashComputations(hashComputations);
}

export function arrayAtIndex<T>(twoDArray: Array<T[]>, index: number): T[] {
if (twoDArray[index] === undefined) {
twoDArray[index] = [];
Expand Down

0 comments on commit 6d04f86

Please sign in to comment.