Skip to content

Commit

Permalink
Check dependency in hashgraph
Browse files Browse the repository at this point in the history
  • Loading branch information
elielnfinic committed Nov 13, 2024
1 parent baf22c2 commit 7038a45
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 12 deletions.
10 changes: 1 addition & 9 deletions packages/object/src/hashgraph/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -118,17 +118,9 @@ export class HashGraph {
return vertex;
}

checkVertexDependency(
operation: Operation,
checkDependencyInHashgraph(
deps: Hash[],
nodeId: string,
): boolean {
const hash = computeHash(nodeId, operation, deps);
if (this.vertices.has(hash)) {
return true;
}

// Temporary fix: don't add the vertex if the dependencies are not present in the local HG.
if (
!deps.every((dep) => this.forwardEdges.has(dep) || this.vertices.has(dep))
) {
Expand Down
4 changes: 1 addition & 3 deletions packages/object/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -114,10 +114,8 @@ export class TopologyObject implements ITopologyObject {
continue;
}
if (
!this.hashGraph.checkVertexDependency(
vertex.operation,
!this.hashGraph.checkDependencyInHashgraph(
vertex.dependencies,
vertex.nodeId,
)
) {
if (synchronizeVertices)
Expand Down

0 comments on commit 7038a45

Please sign in to comment.