From 7cc5c69aa9e7a3502d04e2fe45a8504c2df97f65 Mon Sep 17 00:00:00 2001 From: Christophe Diederichs <45171645+chm-diederichs@users.noreply.github.com> Date: Wed, 4 Dec 2024 15:36:44 +0100 Subject: [PATCH] Revert "can explicitly pass snapshot shared length (#41)" (#42) This reverts commit 56f26612b1d289aca6f6b36640dc80cc02632ddd. --- index.js | 9 ++------- 1 file changed, 2 insertions(+), 7 deletions(-) diff --git a/index.js b/index.js index bf38c55..b79c3e8 100644 --- a/index.js +++ b/index.js @@ -487,16 +487,11 @@ class HypercoreStorage { return new MemoryOverlay(this) } - snapshot (sharedLength = -1) { + snapshot () { assert(this.destroyed === false) const s = new HypercoreStorage(this.root, this.discoveryKey, this.corePointer, this.dataPointer, this.db.snapshot()) - for (const dep of this.dependencies) { - const length = sharedLength !== -1 && sharedLength < dep.length ? sharedLength : dep.length - s.dependencies.push({ data: dep.data, length }) - - if (length === sharedLength) break - } + for (const dep of this.dependencies) s.dependencies.push(dep) return s }