hypercore 11.39.5 → 11.39.6
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/replicator.js +1 -0
- package/lib/session-state.js +6 -4
- package/package.json +1 -1
package/lib/replicator.js
CHANGED
package/lib/session-state.js
CHANGED
|
@@ -153,8 +153,9 @@ class SessionState {
|
|
|
153
153
|
}
|
|
154
154
|
|
|
155
155
|
async _updateSnapshotStorage(storage) {
|
|
156
|
-
|
|
157
|
-
|
|
156
|
+
const atom = this.atomized
|
|
157
|
+
if (!atom || !atom.flushing) return this.treeInfo()
|
|
158
|
+
while (atom.flushing) await atom.flushed()
|
|
158
159
|
|
|
159
160
|
let rx = storage.read()
|
|
160
161
|
const headPromise = rx.getHead()
|
|
@@ -597,11 +598,12 @@ class SessionState {
|
|
|
597
598
|
const [left, right] = flat.spans(b)
|
|
598
599
|
const s = left / 2
|
|
599
600
|
const e = right / 2 + 1
|
|
600
|
-
const has =
|
|
601
|
+
const has = start <= s && e <= end ? false : this.core.bitfield.hasSet(s, e - s)
|
|
601
602
|
if (has) break
|
|
602
603
|
|
|
603
604
|
tx.deleteTreeNode(a)
|
|
604
|
-
|
|
605
|
+
// delete the whole sibling subtree as it isnt needed per `has` check
|
|
606
|
+
tx.deleteTreeNodeRange(left, right + 1)
|
|
605
607
|
}
|
|
606
608
|
|
|
607
609
|
if (this.isDefault()) {
|