mirror of
https://github.com/tornadocash/fixed-merkle-tree.git
synced 2024-11-22 01:37:09 +01:00
prettier
This commit is contained in:
parent
4f6ff9b777
commit
823545596e
6
.prettierrc
Normal file
6
.prettierrc
Normal file
@ -0,0 +1,6 @@
|
|||||||
|
{
|
||||||
|
"semi": false,
|
||||||
|
"arrowParens": "always",
|
||||||
|
"singleQuote": true,
|
||||||
|
"printWidth": 110
|
||||||
|
}
|
@ -47,9 +47,9 @@ class MerkleTree {
|
|||||||
for (let i = 0; i < Math.ceil(this._layers[level - 1].length / 2); i++) {
|
for (let i = 0; i < Math.ceil(this._layers[level - 1].length / 2); i++) {
|
||||||
this._layers[level][i] = this._hash(
|
this._layers[level][i] = this._hash(
|
||||||
this._layers[level - 1][i * 2],
|
this._layers[level - 1][i * 2],
|
||||||
i * 2 + 1 < this._layers[level - 1].length ?
|
i * 2 + 1 < this._layers[level - 1].length
|
||||||
this._layers[level - 1][i * 2 + 1] :
|
? this._layers[level - 1][i * 2 + 1]
|
||||||
this._zeros[level - 1],
|
: this._zeros[level - 1]
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -100,9 +100,9 @@ class MerkleTree {
|
|||||||
index >>= 1
|
index >>= 1
|
||||||
this._layers[level][index] = this._hash(
|
this._layers[level][index] = this._hash(
|
||||||
this._layers[level - 1][index * 2],
|
this._layers[level - 1][index * 2],
|
||||||
index * 2 + 1 < this._layers[level - 1].length ?
|
index * 2 + 1 < this._layers[level - 1].length
|
||||||
this._layers[level - 1][index * 2 + 1] :
|
? this._layers[level - 1][index * 2 + 1]
|
||||||
this._zeros[level - 1],
|
: this._zeros[level - 1]
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -120,9 +120,8 @@ class MerkleTree {
|
|||||||
const pathIndices = []
|
const pathIndices = []
|
||||||
for (let level = 0; level < this.levels; level++) {
|
for (let level = 0; level < this.levels; level++) {
|
||||||
pathIndices[level] = index % 2
|
pathIndices[level] = index % 2
|
||||||
pathElements[level] = (index ^ 1) < this._layers[level].length ?
|
pathElements[level] =
|
||||||
this._layers[level][index ^ 1] :
|
(index ^ 1) < this._layers[level].length ? this._layers[level][index ^ 1] : this._zeros[level]
|
||||||
this._zeros[level]
|
|
||||||
index >>= 1
|
index >>= 1
|
||||||
}
|
}
|
||||||
return {
|
return {
|
||||||
|
Loading…
Reference in New Issue
Block a user