mirror of
https://github.com/tornadocash/tornado-core.git
synced 2025-06-24 14:10:40 -04:00
make _roots constant sized array
This commit is contained in:
parent
2bb751bfd1
commit
1364762b93
1 changed files with 2 additions and 3 deletions
|
@ -19,7 +19,7 @@ contract MerkleTreeWithHistory {
|
|||
uint256 public levels;
|
||||
|
||||
uint256 constant ROOT_HISTORY_SIZE = 100;
|
||||
uint256[] private _roots;
|
||||
uint256[ROOT_HISTORY_SIZE] private _roots;
|
||||
uint256 public current_root = 0;
|
||||
|
||||
uint256[] private _filled_subtrees;
|
||||
|
@ -38,7 +38,6 @@ contract MerkleTreeWithHistory {
|
|||
_filled_subtrees.push(_zeros[i]);
|
||||
}
|
||||
|
||||
_roots = new uint256[](ROOT_HISTORY_SIZE);
|
||||
_roots[0] = hashLeftRight(_zeros[levels - 1], _zeros[levels - 1]);
|
||||
}
|
||||
|
||||
|
@ -122,7 +121,7 @@ contract MerkleTreeWithHistory {
|
|||
return _roots[current_root];
|
||||
}
|
||||
|
||||
function roots() public view returns(uint256[] memory) {
|
||||
function roots() public view returns(uint256[ROOT_HISTORY_SIZE] memory) {
|
||||
return _roots;
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue