hypercore 10.18.3 → 10.18.4

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.
@@ -56,6 +56,23 @@ class MerkleTreeBatch {
56
56
  this.upgraded = false
57
57
  }
58
58
 
59
+ clone () {
60
+ const b = new MerkleTreeBatch(this.tree)
61
+
62
+ b.fork = this.fork
63
+ b.roots = [...this.roots]
64
+ b.length = this.length
65
+ b.byteLength = this.byteLength
66
+ b.signature = this.signature
67
+ b.treeLength = this.treeLength
68
+ b.treeFork = this.treeFork
69
+ b.tree = this.tree
70
+ b.nodes = [...this.nodes]
71
+ b.upgraded = this.upgraded
72
+
73
+ return b
74
+ }
75
+
59
76
  hash () {
60
77
  return this.tree.crypto.tree(this.roots)
61
78
  }
package/lib/replicator.js CHANGED
@@ -141,7 +141,7 @@ class RangeRequest extends Attachable {
141
141
  const i = this.ranges.indexOf(this)
142
142
  if (i === -1) return
143
143
  const h = this.ranges.pop()
144
- if (i < this.ranges.length - 1) this.ranges[i] = h
144
+ if (i < this.ranges.length) this.ranges[i] = h
145
145
  }
146
146
 
147
147
  _cancel (r) {
@@ -183,7 +183,7 @@ class SeekRequest extends Attachable {
183
183
  const i = this.seeks.indexOf(this)
184
184
  if (i === -1) return
185
185
  const h = this.seeks.pop()
186
- if (i < this.seeks.length - 1) this.seeks[i] = h
186
+ if (i < this.seeks.length) this.seeks[i] = h
187
187
  }
188
188
  }
189
189
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "hypercore",
3
- "version": "10.18.3",
3
+ "version": "10.18.4",
4
4
  "description": "Hypercore is a secure, distributed append-only log",
5
5
  "main": "index.js",
6
6
  "scripts": {