diff --git a/lib/core.js b/lib/core.js index 5dead051..4790f3cd 100644 --- a/lib/core.js +++ b/lib/core.js @@ -466,7 +466,9 @@ module.exports = class Core { length: (length === treeLength || !treeInfo) ? treeLength : treeInfo.length }) - return new SessionState(this, storage, this.blocks, tree, bitfield, treeLength, null, null) + const sharedLength = Math.min(treeLength, tree.length) + + return new SessionState(this, storage, this.blocks, tree, bitfield, sharedLength, null, null) } static async open (db, opts = {}) {