hypercore 11.39.4 → 11.39.5

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.
Files changed (2) hide show
  1. package/lib/replicator.js +11 -1
  2. package/package.json +1 -1
package/lib/replicator.js CHANGED
@@ -1411,6 +1411,12 @@ class Peer {
1411
1411
  const has = drop === false
1412
1412
 
1413
1413
  if (drop === true && start < this._remoteContiguousLength) {
1414
+ const end = start + length
1415
+ if (end < this._remoteContiguousLength) {
1416
+ this.remoteBitfield.setRange(end, this._remoteContiguousLength, true)
1417
+ this.missingBlocks.setRange(end, this._remoteContiguousLength, true)
1418
+ this._clearLocalRange(end, this._remoteContiguousLength - end)
1419
+ }
1414
1420
  this._remoteContiguousLength = start
1415
1421
  }
1416
1422
 
@@ -3040,7 +3046,11 @@ module.exports = class Replicator {
3040
3046
  const blks = new RandomIterator(this._queued)
3041
3047
 
3042
3048
  for (const b of blks) {
3043
- if (b.queued === false || peer._requestBlock(b) === true) {
3049
+ if (b.queued === false) {
3050
+ blks.dequeue()
3051
+ continue
3052
+ }
3053
+ if (peer._requestBlock(b) === true) {
3044
3054
  b.queued = false
3045
3055
  blks.dequeue()
3046
3056
  return true
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "hypercore",
3
- "version": "11.39.4",
3
+ "version": "11.39.5",
4
4
  "description": "Hypercore is a secure, distributed append-only log",
5
5
  "main": "index.js",
6
6
  "scripts": {