hypercore 11.21.0 → 11.21.2
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 +11 -7
- package/package.json +1 -1
package/lib/replicator.js
CHANGED
|
@@ -187,7 +187,7 @@ class RangeRequest extends Attachable {
|
|
|
187
187
|
this.ifAvailable = ifAvailable
|
|
188
188
|
this.blocks = blocks
|
|
189
189
|
this.ranges = ranges
|
|
190
|
-
|
|
190
|
+
ranges.push(this)
|
|
191
191
|
|
|
192
192
|
if (this.end === -1) {
|
|
193
193
|
this.replicator._alwaysLatestBlock++
|
|
@@ -199,13 +199,12 @@ class RangeRequest extends Attachable {
|
|
|
199
199
|
}
|
|
200
200
|
|
|
201
201
|
_unref() {
|
|
202
|
-
|
|
203
|
-
if (
|
|
202
|
+
const rangeIndex = this.ranges.indexOf(this)
|
|
203
|
+
if (rangeIndex === -1) return
|
|
204
204
|
|
|
205
205
|
const h = this.ranges.pop()
|
|
206
206
|
if (h !== this) {
|
|
207
|
-
this.ranges[
|
|
208
|
-
h.rangeIndex = this.rangeIndex
|
|
207
|
+
this.ranges[rangeIndex] = h
|
|
209
208
|
}
|
|
210
209
|
|
|
211
210
|
if (this.end === -1) {
|
|
@@ -922,10 +921,15 @@ class Peer {
|
|
|
922
921
|
}
|
|
923
922
|
}
|
|
924
923
|
|
|
924
|
+
let req = null
|
|
925
925
|
const batch = this.core.storage.read()
|
|
926
|
-
|
|
927
|
-
|
|
926
|
+
try {
|
|
927
|
+
req = await this._getProof(batch, msg, true)
|
|
928
|
+
} catch {
|
|
929
|
+
return
|
|
930
|
+
}
|
|
928
931
|
|
|
932
|
+
if (req === null) return
|
|
929
933
|
batch.tryFlush()
|
|
930
934
|
|
|
931
935
|
await this._fulfillRequest(req, true)
|