Resolved invalid proof issue
This commit is contained in:
parent
0029efd325
commit
a5dfe1acf3
5
index.js
5
index.js
|
@ -151,12 +151,13 @@ class MerkleTree {
|
|||
return []
|
||||
}
|
||||
|
||||
for (let i = 0; i < this.layers.length; i++) {
|
||||
for (let i = 0; i < this.layers.length -1; i++) {
|
||||
const layer = this.layers[i]
|
||||
const isRightNode = index % 2
|
||||
const pairIndex = (isRightNode ? index - 1 : index + 1)
|
||||
const pairIndex = (isRightNode ? index - 1 : index)
|
||||
|
||||
if (pairIndex < layer.length) {
|
||||
|
||||
proof.push({
|
||||
position: isRightNode ? 'left': 'right',
|
||||
data: layer[pairIndex]
|
||||
|
|
File diff suppressed because it is too large
Load Diff
Loading…
Reference in New Issue