Skip to content
This repository has been archived by the owner on Jun 11, 2024. It is now read-only.

Commit

Permalink
Merge pull request #6663 from LiskHQ/6655-smt-root
Browse files Browse the repository at this point in the history
On update root is saved twice on sparse merkle tree - Closes #6655
  • Loading branch information
ManuGowda authored Aug 21, 2021
2 parents 56db34f + f90f350 commit 876e133
Showing 1 changed file with 2 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -163,11 +163,9 @@ export class SparseMerkleTree {
bottomNode = p;
h -= 1;
}
rootNode = bottomNode;
this._rootHash = rootNode.hash;
await this._db.set(rootNode.hash, (rootNode as Branch).data);
this._rootHash = bottomNode.hash;

return rootNode;
return bottomNode;
}

public async remove(key: Buffer): Promise<TreeNode> {
Expand Down Expand Up @@ -255,7 +253,6 @@ export class SparseMerkleTree {
h -= 1;
}
this._rootHash = bottomNode.hash;
await this._db.set(bottomNode.hash, (bottomNode as Branch).data);

return bottomNode;
}
Expand Down

0 comments on commit 876e133

Please sign in to comment.