mirror of
https://github.com/tornadocash/fixed-merkle-tree.git
synced 2025-01-04 02:45:21 +01:00
Fix lint erros
This commit is contained in:
parent
8ce9847652
commit
f9d7765305
@ -141,7 +141,7 @@ export class BaseTree {
|
|||||||
* @returns {number[]} the new list of indices
|
* @returns {number[]} the new list of indices
|
||||||
*/
|
*/
|
||||||
static nextLayerMultiPathIndices(indices: number[]): number[] {
|
static nextLayerMultiPathIndices(indices: number[]): number[] {
|
||||||
let nextIndices: Set<number> = new Set()
|
const nextIndices: Set<number> = new Set()
|
||||||
for (let i = 0; i < indices.length; i++) {
|
for (let i = 0; i < indices.length; i++) {
|
||||||
nextIndices.add(indices[i] >> 1)
|
nextIndices.add(indices[i] >> 1)
|
||||||
}
|
}
|
||||||
@ -158,10 +158,10 @@ export class BaseTree {
|
|||||||
let layerIndices = indices
|
let layerIndices = indices
|
||||||
for (let level = 0; level < this.levels; level++) {
|
for (let level = 0; level < this.levels; level++) {
|
||||||
// find whether there is a neighbor idx that is not in layerIndices
|
// find whether there is a neighbor idx that is not in layerIndices
|
||||||
let proofElements = layerIndices.reduce((elements, idx) => {
|
const proofElements = layerIndices.reduce((elements, idx) => {
|
||||||
const leafIndex = idx ^ 1
|
const leafIndex = idx ^ 1
|
||||||
if (!layerIndices.includes(leafIndex)) {
|
if (!layerIndices.includes(leafIndex)) {
|
||||||
if (leafIndex < this._layers[level].length) {
|
if (leafIndex < this._layers[level].length) {
|
||||||
elements.push(this._layers[level][leafIndex])
|
elements.push(this._layers[level][leafIndex])
|
||||||
} else {
|
} else {
|
||||||
elements.push(this._zeros[level])
|
elements.push(this._zeros[level])
|
||||||
@ -199,14 +199,14 @@ export class BaseTree {
|
|||||||
): boolean {
|
): boolean {
|
||||||
let layerElements: Element[] = leaves
|
let layerElements: Element[] = leaves
|
||||||
let layerIndices: number[] = leafIndices
|
let layerIndices: number[] = leafIndices
|
||||||
let proofElements: Element[] = pathElements
|
const proofElements: Element[] = pathElements
|
||||||
let layerProofs: Element[] = []
|
const layerProofs: Element[] = []
|
||||||
|
|
||||||
for (let level = 0; level < levels; level++) {
|
for (let level = 0; level < levels; level++) {
|
||||||
for (let i = 0; i < layerIndices.length; i++) {
|
for (let i = 0; i < layerIndices.length; i++) {
|
||||||
let layerHash: string
|
let layerHash: string
|
||||||
let elIndex = layerIndices[i]
|
const elIndex = layerIndices[i]
|
||||||
let leafIndex = elIndex ^ 1
|
const leafIndex = elIndex ^ 1
|
||||||
if (layerIndices.includes(leafIndex)) {
|
if (layerIndices.includes(leafIndex)) {
|
||||||
if (elIndex % 2 === 0) {
|
if (elIndex % 2 === 0) {
|
||||||
layerHash = hashFn(layerElements[0], layerElements[1])
|
layerHash = hashFn(layerElements[0], layerElements[1])
|
||||||
|
@ -70,7 +70,7 @@ export default class MerkleTree extends BaseTree {
|
|||||||
}
|
}
|
||||||
|
|
||||||
multiProof(elements: Element[]): MultiProofPath {
|
multiProof(elements: Element[]): MultiProofPath {
|
||||||
let indexes = []
|
const indexes = []
|
||||||
for (let i = 0; i < elements.length; i++) {
|
for (let i = 0; i < elements.length; i++) {
|
||||||
indexes.push(this.indexOf(elements[i]))
|
indexes.push(this.indexOf(elements[i]))
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user