mirror of
https://github.com/tornadocash/fixed-merkle-tree.git
synced 2024-11-24 10:54:15 +01:00
fix tree slices order
This commit is contained in:
parent
e9f123a8b2
commit
6df03ab139
@ -204,12 +204,12 @@ export default class MerkleTree {
|
||||
let size = Math.ceil(length / count)
|
||||
size % 2 && size++
|
||||
const slices = []
|
||||
for (let i = length - size - 1; i > -size; i -= size) {
|
||||
const edgeLeft = i >= 0 ? i : 0
|
||||
for (let i = 0; i < length; i += size) {
|
||||
const edgeLeft = i
|
||||
const edgeRight = i + size
|
||||
slices.push({ edge: this.getTreeEdge(edgeLeft), elements: this.elements.slice(edgeLeft, edgeRight) })
|
||||
}
|
||||
return slices.reverse()
|
||||
return slices
|
||||
}
|
||||
|
||||
/**
|
||||
|
Loading…
Reference in New Issue
Block a user