hypercore 10.28.9 → 10.28.10

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/core.js +14 -5
  2. package/package.json +1 -1
package/lib/core.js CHANGED
@@ -919,12 +919,21 @@ async function flushHeader (oplog, bigHeader, header) {
919
919
  function noop () {}
920
920
 
921
921
  function maximumSegmentStart (start, src, dst) {
922
- const a = src.firstSet(start)
923
- const b = dst.firstUnset(start)
922
+ while (true) {
923
+ const a = src.firstSet(start)
924
+ const b = dst.firstUnset(start)
924
925
 
925
- if (a === -1) return -1
926
- if (b === -1) return a
927
- return a < b ? b : a
926
+ if (a === -1) return -1
927
+ if (b === -1) return a
928
+
929
+ // if dst has the segment, restart
930
+ if (a < b) {
931
+ start = b
932
+ continue
933
+ }
934
+
935
+ return a
936
+ }
928
937
  }
929
938
 
930
939
  function minimumSegmentEnd (start, src, dst) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "hypercore",
3
- "version": "10.28.9",
3
+ "version": "10.28.10",
4
4
  "description": "Hypercore is a secure, distributed append-only log",
5
5
  "main": "index.js",
6
6
  "scripts": {