Skip to content

Commit

Permalink
refactor
Browse files Browse the repository at this point in the history
  • Loading branch information
Amxx committed Feb 26, 2024
1 parent e13943e commit e5e035e
Showing 1 changed file with 2 additions and 5 deletions.
7 changes: 2 additions & 5 deletions src/merkletree.ts
Original file line number Diff line number Diff line change
Expand Up @@ -84,11 +84,8 @@ export abstract class MerkleTreeImpl<T> implements MerkleTree<T> {
}

validate() {
// Check values are correct, and tree is hashed correctly
invariant(
this.values.every((_, i) => this._verifyAndHash(i)) && isValidMerkleTree(this.tree),
'Merkle tree is invalid',
);
this.values.forEach((_, i) => this._verifyAndHash(i));
invariant(isValidMerkleTree(this.tree), 'Merkle tree is invalid');
}

leafLookup(leaf: T): number {
Expand Down

0 comments on commit e5e035e

Please sign in to comment.