mirror of
https://github.com/tornadocash/tornado-core.git
synced 2024-11-22 01:37:07 +01:00
make sure pathIndex is always a number (fixes bug with string concat instead of integer addition)
This commit is contained in:
parent
bc8d0b20fc
commit
1a17e7eea3
@ -1,6 +1,5 @@
|
||||
const jsStorage = require('./Storage')
|
||||
const hasherImpl = require('./MiMC')
|
||||
const { bigInt } = require('snarkjs')
|
||||
|
||||
class MerkleTree {
|
||||
|
||||
@ -12,7 +11,7 @@ class MerkleTree {
|
||||
this.zero_values = []
|
||||
this.totalElements = 0
|
||||
|
||||
let current_zero_value = bigInt('5702960885942360421128284892092891246826997279710054143430547229469817701242')
|
||||
let current_zero_value = '5702960885942360421128284892092891246826997279710054143430547229469817701242'
|
||||
this.zero_values.push(current_zero_value)
|
||||
for (let i = 0; i < n_levels; i++) {
|
||||
current_zero_value = this.hasher.hash(i, current_zero_value, current_zero_value)
|
||||
@ -77,6 +76,7 @@ class MerkleTree {
|
||||
this.path_index.push(element_index % 2)
|
||||
}
|
||||
}
|
||||
index = Number(index)
|
||||
let traverser = new PathTraverser(this.prefix, this.storage, this.zero_values)
|
||||
const root = await this.storage.get_or_element(
|
||||
MerkleTree.index_to_key(this.prefix, this.n_levels, 0),
|
||||
|
Loading…
Reference in New Issue
Block a user