mirror of
https://github.com/tornadocash/tornado-core.git
synced 2025-05-09 17:54:58 -04:00
changed emptyElement to constant
This commit is contained in:
parent
27a00bfd5f
commit
1fdabcc97c
13 changed files with 27 additions and 46 deletions
|
@ -1,9 +1,10 @@
|
|||
const jsStorage = require('./Storage')
|
||||
const hasherImpl = require('./MiMC')
|
||||
const { bigInt } = require('snarkjs')
|
||||
|
||||
class MerkleTree {
|
||||
|
||||
constructor(n_levels, zero_value, defaultElements, prefix, storage, hasher) {
|
||||
constructor(n_levels, defaultElements, prefix, storage, hasher) {
|
||||
this.prefix = prefix
|
||||
this.storage = storage || new jsStorage()
|
||||
this.hasher = hasher || new hasherImpl()
|
||||
|
@ -11,7 +12,7 @@ class MerkleTree {
|
|||
this.zero_values = []
|
||||
this.totalElements = 0
|
||||
|
||||
let current_zero_value = zero_value || 0
|
||||
let current_zero_value = bigInt('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)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue