Skip to content

Commit

Permalink
use minimum shared length (#577)
Browse files Browse the repository at this point in the history
  • Loading branch information
chm-diederichs authored Oct 7, 2024
1 parent f4047e5 commit 1dd49ed
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion lib/core.js
Original file line number Diff line number Diff line change
Expand Up @@ -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 = {}) {
Expand Down

0 comments on commit 1dd49ed

Please sign in to comment.