From e2dbc0afe3eec303bc3bdf8c0f43a489b83e5d56 Mon Sep 17 00:00:00 2001 From: Mathias Buus Date: Wed, 19 Feb 2025 19:15:51 +0100 Subject: [PATCH] use signedLength instead of indexedLength --- index.js | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/index.js b/index.js index 1e3f664..13af5bd 100644 --- a/index.js +++ b/index.js @@ -56,7 +56,7 @@ function createUnionMap (keyEncoding, valueEncoding) { if (!haveSameNewValue) { // apply-entry wins, but the previous state (.right) is not the value - // at the last indexedLength, since a diffEntry to undo exists for the same key + // at the last signedLength, since a diffEntry to undo exists for the same key // So we yield that to-undo diffEntry's final state as previous state for this change return filterSameValue({ left: decode(applyDiffEntry.left), @@ -85,13 +85,13 @@ class BeeDiffStream extends Union { // Binary encodings for easier comparison later opts = { ...opts, gt, gte, lt, lte, valueEncoding: 'binary', keyEncoding: 'binary' } - if (leftSnapshot.core.indexedLength === undefined) { - throw new Error('Incompatible Hypercore version--must have indexedLength property') + if (leftSnapshot.core.signedLength === undefined) { + throw new Error('Incompatible Hypercore version--must have signedLength property') } // We know that everything indexed in both snapshots is shared const sharedIndexedL = Math.min( - leftSnapshot.core.indexedLength, rightSnapshot.core.indexedLength + leftSnapshot.core.signedLength, rightSnapshot.core.signedLength ) // TODO: consider optimisation for case where the version of both streams