hypercore 10.0.0-alpha.28 → 10.0.0-alpha.30
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 +6 -4
- package/package.json +1 -1
package/lib/replicator.js
CHANGED
|
@@ -48,8 +48,8 @@ class Attachable {
|
|
|
48
48
|
const rh = this.refs.pop()
|
|
49
49
|
const sh = r.session.pop()
|
|
50
50
|
|
|
51
|
-
if (r.rindex < this.refs.length
|
|
52
|
-
if (r.sindex < r.session.length
|
|
51
|
+
if (r.rindex < this.refs.length) this.refs[rh.rindex = r.rindex] = rh
|
|
52
|
+
if (r.sindex < r.session.length) r.session[sh.sindex = r.sindex] = sh
|
|
53
53
|
|
|
54
54
|
r.context = null
|
|
55
55
|
|
|
@@ -1124,11 +1124,13 @@ module.exports = class Replicator {
|
|
|
1124
1124
|
}
|
|
1125
1125
|
|
|
1126
1126
|
_clearInflightBlock (tracker, req) {
|
|
1127
|
-
const
|
|
1127
|
+
const isBlock = tracker === this._blocks
|
|
1128
|
+
const index = isBlock === true ? req.block.index : req.hash.index / 2
|
|
1129
|
+
const b = tracker.get(req.fork, index)
|
|
1128
1130
|
|
|
1129
1131
|
if (b === null || removeInflight(b.inflight, req) === false) return
|
|
1130
1132
|
|
|
1131
|
-
if (b.refs.length > 0 &&
|
|
1133
|
+
if (b.refs.length > 0 && isBlock === true) {
|
|
1132
1134
|
this._queueBlock(b)
|
|
1133
1135
|
return
|
|
1134
1136
|
}
|