Skip to content

Commit

Permalink
set parent on old roots if not set
Browse files Browse the repository at this point in the history
  • Loading branch information
mafintosh committed Mar 19, 2016
1 parent 35f7c21 commit 1d491b2
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions generator.js
Expand Up @@ -13,6 +13,11 @@ function MerkleGenerator (opts, roots) {
this.roots = roots || opts.roots || []
this.blocks = this.roots.length ? 1 + flat.rightSpan(this.roots[this.roots.length - 1].index) / 2 : 0

for (var i = 0; i < this.roots.length; i++) {
var r = this.roots[i]
if (r && !r.parent) r.parent = flat.parent(r.index)
}

this._leaf = opts.leaf
this._parent = opts.parent
}
Expand Down

0 comments on commit 1d491b2

Please sign in to comment.