mirror of
https://github.com/tornadocash/tornado-core.git
synced 2024-11-25 19:30:11 +01:00
Merge pull request #10 from DryginAlexander/master
fix Merkle tree capacity
This commit is contained in:
commit
7ed13aa8e0
@ -58,7 +58,7 @@ contract MerkleTreeWithHistory {
|
|||||||
|
|
||||||
function _insert(uint256 leaf) internal {
|
function _insert(uint256 leaf) internal {
|
||||||
uint32 current_index = next_index;
|
uint32 current_index = next_index;
|
||||||
require(current_index != 2**(levels - 1), "Merkle tree is full");
|
require(current_index != 2**levels, "Merkle tree is full");
|
||||||
next_index += 1;
|
next_index += 1;
|
||||||
uint256 current_level_hash = leaf;
|
uint256 current_level_hash = leaf;
|
||||||
uint256 left;
|
uint256 left;
|
||||||
|
@ -180,7 +180,7 @@ contract('MerkleTreeWithHistory', accounts => {
|
|||||||
zeroValue = 1337
|
zeroValue = 1337
|
||||||
merkleTreeWithHistory = await MerkleTreeWithHistory.new(levels, zeroValue)
|
merkleTreeWithHistory = await MerkleTreeWithHistory.new(levels, zeroValue)
|
||||||
|
|
||||||
for (let i = 0; i < 2**(levels - 1); i++) {
|
for (let i = 0; i < 2**levels; i++) {
|
||||||
await merkleTreeWithHistory.insert(i+42).should.be.fulfilled
|
await merkleTreeWithHistory.insert(i+42).should.be.fulfilled
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user