make _roots constant sized array

This commit is contained in:
poma 2019-11-01 04:31:57 +03:00
parent 2bb751bfd1
commit 1364762b93
1 changed files with 2 additions and 3 deletions

View File

@ -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;
}