hypercore 11.32.0 → 11.33.0

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 CHANGED
@@ -233,13 +233,12 @@ class RangeBatchRequest extends Attachable {
233
233
  }
234
234
 
235
235
  class RangeRequest extends Attachable {
236
- constructor(replicator, ranges, start, end, linear, ifAvailable, blocks) {
236
+ constructor(replicator, ranges, start, end, linear, blocks) {
237
237
  super(replicator)
238
238
 
239
239
  this.start = start
240
240
  this.end = end
241
241
  this.linear = linear
242
- this.ifAvailable = ifAvailable
243
242
  this.blocks = blocks
244
243
  this.ranges = ranges
245
244
  this.batches = []
@@ -2230,14 +2229,7 @@ module.exports = class Replicator {
2230
2229
 
2231
2230
  addRange(
2232
2231
  session,
2233
- {
2234
- start = 0,
2235
- end = -1,
2236
- length = toLength(start, end),
2237
- blocks = null,
2238
- linear = false,
2239
- ifAvailable = false
2240
- } = {}
2232
+ { start = 0, end = -1, length = toLength(start, end), blocks = null, linear = false } = {}
2241
2233
  ) {
2242
2234
  if (blocks !== null) {
2243
2235
  // if using blocks, start, end just acts as frames around the blocks array
@@ -2251,7 +2243,6 @@ module.exports = class Replicator {
2251
2243
  start,
2252
2244
  length === -1 ? -1 : start + length,
2253
2245
  linear,
2254
- ifAvailable,
2255
2246
  blocks
2256
2247
  )
2257
2248
 
@@ -2464,7 +2455,6 @@ module.exports = class Replicator {
2464
2455
  this.updateAll()
2465
2456
  } else {
2466
2457
  this._checkUpgradeIfAvailable()
2467
- this._maybeResolveIfAvailableRanges()
2468
2458
  }
2469
2459
  }
2470
2460
 
@@ -2658,23 +2648,6 @@ module.exports = class Replicator {
2658
2648
  if (this._inflight.idle || updateAll) this.updateAll()
2659
2649
  }
2660
2650
 
2661
- _maybeResolveIfAvailableRanges() {
2662
- if (this._ifAvailable > 0 || !this._inflight.idle || !this._ranges.length) return
2663
-
2664
- for (let i = 0; i < this.peers.length; i++) {
2665
- if (this.peers[i].dataProcessing > 0) return
2666
- }
2667
-
2668
- for (let i = 0; i < this._ranges.length; i++) {
2669
- const r = this._ranges[i]
2670
-
2671
- if (r.ifAvailable) {
2672
- this._resolveRangeRequest(r)
2673
- i--
2674
- }
2675
- }
2676
- }
2677
-
2678
2651
  _clearRequest(peer, req) {
2679
2652
  if (req.block !== null) {
2680
2653
  this._clearInflightBlock(this._blocks, req)
@@ -3025,7 +2998,6 @@ module.exports = class Replicator {
3025
2998
  }
3026
2999
 
3027
3000
  this._checkUpgradeIfAvailable()
3028
- this._maybeResolveIfAvailableRanges()
3029
3001
  }
3030
3002
 
3031
3003
  updateAll() {
@@ -3053,7 +3025,6 @@ module.exports = class Replicator {
3053
3025
  }
3054
3026
 
3055
3027
  this._checkUpgradeIfAvailable()
3056
- this._maybeResolveIfAvailableRanges()
3057
3028
  }
3058
3029
 
3059
3030
  onpeerdestroy() {
@@ -224,7 +224,11 @@ class SessionState {
224
224
 
225
225
  tx.deleteGroupUpdate(pointer, this.core.header.tree.timestamp)
226
226
  tx.putGroupUpdate(pointer, tree.timestamp, this.core.header.key)
227
- this.core.ongroupupdate(this.core.header.group.key)
227
+ this.core.ongroupupdate(this.core.header.group.key, {
228
+ key: this.core.key,
229
+ length: tree.length,
230
+ fork: tree.fork
231
+ })
228
232
  }
229
233
 
230
234
  _clearActiveBatch() {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "hypercore",
3
- "version": "11.32.0",
3
+ "version": "11.33.0",
4
4
  "description": "Hypercore is a secure, distributed append-only log",
5
5
  "main": "index.js",
6
6
  "scripts": {