Skip to content

Commit

Permalink
fix: remove getHashComputations() in ListValidator ViewDU
Browse files Browse the repository at this point in the history
  • Loading branch information
twoeths committed Jun 25, 2024
1 parent f291024 commit 9699e21
Showing 1 changed file with 6 additions and 3 deletions.
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import {HashComputationGroup, Node, digestNLevelUnsafe, getHashComputations, setNodesAtDepth} from "@chainsafe/persistent-merkle-tree";
import {HashComputationGroup, Node, digestNLevelUnsafe, setNodesAtDepth} from "@chainsafe/persistent-merkle-tree";
import { ListCompositeType } from "../../../../src/type/listComposite";
import { ArrayCompositeTreeViewDUCache } from "../../../../src/viewDU/arrayComposite";
import { ListCompositeTreeViewDU } from "../../../../src/viewDU/listComposite";
Expand Down Expand Up @@ -43,7 +43,8 @@ export class ListValidatorTreeViewDU extends ListCompositeTreeViewDU<ValidatorNo
const isOldRootHashed = this._rootNode.h0 !== null;
if (this.viewsChanged.size === 0) {
if (!isOldRootHashed && hashComps !== null) {
getHashComputations(this._rootNode, hashComps.offset, hashComps.byLevel);
// not possible to get HashComputations due to BranchNodeStruct
this._rootNode.root;
}
return;
}
Expand Down Expand Up @@ -119,7 +120,9 @@ export class ListValidatorTreeViewDU extends ListCompositeTreeViewDU<ValidatorNo
);

if (!isOldRootHashed && hashComps !== null) {
getHashComputations(this._rootNode, hashComps.offset, hashComps.byLevel);
// should never happen, handle just in case
// not possible to get HashComputations due to BranchNodeStruct
this._rootNode.root;
}

this.viewsChanged.clear();
Expand Down

0 comments on commit 9699e21

Please sign in to comment.